• notice
  • Congratulations on the launch of the Sought Tech site

The Laravel framework uses namespaces to build a completely separated front-end and back-end

    In the past, when namespaces were used less frequently, modules were generally used To separate the front and back, that is, add the module "Background module/controller/method" before the "controller/method" in the routing control.The framework will determine whether there is a folder called "Background Module Controller" when loading the routing.If it exists, adjust the controller's directory to the module directory.

    Another method is to use different entrances to achieve.The front desk uses index.php as the entrance, and other backends such as the backend use another entrance file.Just change the path in some programs.

The current frameworks have basically begun to add namespaces.To be honest, I don't like namespaces very much, and sometimes I feel that namespaces are a tasteless one.Closer to home, back to the Laravel framework.

Laravel's routing configuration is all written in the file app/routes.php.If you want to add a backend named admin, add in routes.php:

//Route control of the general management background< php to the admin directory.Special attention is that these controllers and the newly created controllers in the admin directory must be designated namespace admin; in this way, the controllers in the admin directory can be accessed through admin/controllers/methods Way out.

Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+