Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Dispatcher and beforeExecuteRoute - extraordinary effects

Hi again. According to that: and that: I added to services.php:

        function () {
            $dispatcher = new \Phalcon\Mvc\Dispatcher();
                $eventsManager = new \Phalcon\Events\Manager();
                    new SecurityService()

            return $dispatcher;

And of course my implementation in service:

   public function beforeExecuteRoute(\Phalcon\Events\Event $event, \Phalcon\Dispatcher $dispatcher)
        $router = new \Phalcon\Mvc\Router();

        if ($router->wasMatched()) {
            //it performs well, according to my expectations
             file_put_contents('test1.txt', 'Well done!');
        //this is sth extraterrestrial !!!
            file_put_contents('test2.txt', 'Phalcon secret parser here');

            echo 'I am in (|)';

Of course I call /index/test action by URL (to ensure that effect occurs at least 5 times, sometimes works in first time, I don't know why)

Could someone tell me, why both files apear when I call /index/test? How can I code when basic control structures don't work?


Favicon request?


Good point!

Browser always sends a request like /favicon.ico even if I don't have anything in head.