Laravel 5找不到CSS文件
我刚刚安装了一个Laravel 5项目上的甲基苯丙胺和我的网页没有找到css文件。
I've just installed a Laravel 5 project on MAMP and my pages are not finding the css files.
这是我app.blade.php文件中的链接,我的CSS:
This is the link to my css in my app.blade.php file:
<link href="/css/app.css" rel="stylesheet">
和我的.htaccess文件中有这样一行:
And my .htaccess file has this line:
RewriteBase /laravel-site/laravel-5-app/public/
在config文件夹我的app.php文件中包含的:
In the config folder my app.php file contains this:
'url' => 'http://localhost:8888/laravel-site/laravel-5-app/public/',
但是,当我打开这个页面:的http://本地主机:8888 / laravel现场/ laravel-5应用程序/公/认证/注册并检查开发工具,它正在寻找在这个位置的css文件:的http://本地主机:8888 / CSS / app.css
But when I open up this page: http://localhost:8888/laravel-site/laravel-5-app/public/auth/login and check the developer tools, it is looking for the css file at this location: http://localhost:8888/css/app.css
正如一个侧面说明,如果我去这个网址: HTTP: //本地主机:8888 / laravel现场/ laravel-5应用程序/公/ 我得到正确的欢迎页面
Just as a side note, if I go to this url: http://localhost:8888/laravel-site/laravel-5-app/public/ I get the correct welcome page.
使用此添加的资产如 CSS
,的JavaScript
,图片
..在刀片文件。
use this to add assets like css
, javascript
, images
.. in to blade file.
对CSS,
<link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css" >
或
<link href="{{ URL::asset('css/app.css') }}" rel="stylesheet" type="text/css" >
作为JS,
<script type="text/javascript" src="{{ asset('js/custom.js') }}"></script>
或
<script type="text/javascript" src="{{ URL::asset('js/custom.js') }}"></script>
图像,
{{ asset('img/photo.jpg'); }}
这里是 DOC