“Proper” separation/difference between index.php and front controller

前端 未结 3 999
终归单人心
终归单人心 2020-12-16 05:46

For a PHP MVC application, what is the difference of the job of the index.php file and front-controller? Is the front-controller in the index.php,

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-16 05:51

    Index.php should initialize the application and call something that deciphers the route into controller and action, and runs them. Look at Yii, Symfony, CodeIgniter, CakePHP, see what they do. All slightly different but same principle.

    An example from Yii's index.php to make the point:

    run();
    

    $config gets passed to the web application, which serves as the front controller.

提交回复
热议问题