My demo.css is placed in public/css/demo.css
<link rel="stylesheet" href="{{asset('css/demo.css')}}">
If you quote like this, 404 will appear if you enter directly from the server.php entry. It is found that the generated link is:
..../server.php/css/demo.css
If accessed from public/index.php this is correct, the generated link is:
..../public/css/demo.css
How do you reference your static files? ? ?
Which entrance is generally used to access the website? ? ?
By the way, my server environment is: wampServer
巴扎黑2017-05-16 16:54:47
The laravel service root directory is public, so you need to put the css file public/css
中,然后再用asset()
辅助函数。
我一般是在resource文件夹中放置静态文件,然后通过gulpcopy()
into the directory corresponding to public
PHPz2017-05-16 16:54:47
You can copy the .htaccess file under public to the project root directory, and then change server.php to index.php to access it. To introduce css files and js files, use {{asset('path') }}.