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

How to set up routing in laravel

(*-*)浩
Release: 2019-10-30 10:38:17
Original
3163 people have browsed it

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
Copy after login

Set routing

The routing file is in app\HTTP\routes.php. Add

Route::get('/hi', function () {
  return 'hello world';
});
Copy after login

to the code. We observe that there is already

in this PHP file.
Route::get('/', function () {
  return view('welcome');
});
Copy after login

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

<!-- Fonts -->
<link href="font-awesome.min.css" rel="external nofollow" rel=&#39;stylesheet&#39; type=&#39;text/css&#39;>
<link href="css.css" rel="external nofollow" rel=&#39;stylesheet&#39; type=&#39;text/css&#39;>
<!-- Styles -->
<link href="bootstrap.min.css" rel="external nofollow" rel="stylesheet">
Copy after login

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!

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