Home>Article>PHP Framework> How to set up routing in laravel
The examples in this article describe the setting and use of Laravel framework routing. Share it with everyone for your reference, the details are as follows:
Laravel installation, here use the one-click installation package.(Recommended learning:laravel development)
Use PHP’s built-in web server and run the command line under the PHP folder
php -S 0.0.0.0:1024
Set routing
The routing file is in app\HTTP\routes.php. Add
Route::get('/hi', function () { return 'hello world'; });
to the code. We observe that there is already
in this PHP file.Route::get('/', function () { return view('welcome'); });
Therefore,The routing file specifies which view the URL will redirect to.
Laravel loads so slowly! The main reason is that Google fonts are quoted, and the cdn speed is not fast. We can change the referenced resources to static resources
Find the app.blade.php file in the directory \resources\views\layouts, and change the css reference to
The speed is getting faster!
The above is the detailed content of How to set up routing in laravel. For more information, please follow other related articles on the PHP Chinese website!