Lavarel basic practice - routing, controller

WBOY
Release: 2016-07-29 08:52:53
Original
1621 people have browsed it

data-id="1190000004972875" data-licence="">

1. Configure all routing information in the /app/Http/routes.php file. Try not to write logical processing information here

<code>Route::group(['prefix' => 'blog', 'namespace' => 'Blog', 'middleware' => 'auth'], function()
{    
    Route::get('columns/create','ColumnsController@create');

});</code>
Copy after login

2. The controller is in AppHttpControllers , it is very convenient to build controllers using Artisan

<code>php artisan make:controller Blog/ColumnsController</code>
Copy after login

3. If your application uses controllers based entirely on routing, you can use Laravel's route cache. Using route cache will greatly reduce the time spent registering all application routes. , in some cases, the route registration speed can even be increased by 100 times!

<code>php artisan route:cache</code>
Copy after login

The above has introduced the basic practices of Lavarel - routing and controller, including lava and var content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!