Home>Article>PHP Framework> How to set up routing in laravel

How to set up routing in laravel

(*-*)浩
(*-*)浩 Original
2019-10-30 10:38:17 3075browse

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:

How to set up routing in laravel

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!

Statement:
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