【发布时间】:2016-01-19 16:59:21
【问题描述】:
我已将资产文件夹复制到公共文件夹并使用
调用了我的 css 文件<link href="{{!! asset('assets/global/plugins/font-awesome/css/font-awesome.min.css') !!}}" rel="stylesheet" type="text/css" />
<link href="{{ asset('assets/global/plugins/font-awesome/css/font-awesome.min.css') }}" rel="stylesheet" type="text/css" />
但是当我打开本地主机查看我的应用程序时,css 不起作用,当我使用检查元素检查 css 时,它会显示此错误
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Object not found!</title>
<link rev="made" href="mailto:postmaster@localhost" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
body { color: #000000; background-color: #FFFFFF; }
a:link { color: #0000CC; }
p, address {margin-left: 3em;}
span {font-size: smaller;}
/*]]>*/--></style>
</head>
<body>
<h1>Object not found!</h1>
<p>
The requested URL was not found on this server.
The link on the
<a href="http://localhost:7777/laravel/resources/views/login.blade.php">referring
page</a> seems to be wrong or outdated. Please inform the author of
<a href="http://localhost:7777/laravel/resources/views/login.blade.php">that page</a>
about the error.
</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:postmaster@localhost">webmaster</a>.
</p>
<h2>Error 404</h2>
<address>
<a href="/">localhost</a><br />
<span>Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.12</span>
</address>
</body>
</html>
【问题讨论】:
-
我用
{{URL::asset('/path/to/css')}} -
我使用 laravel 5.1,这正是我在默认模板中使用的:
<link rel="stylesheet" href="{{URL::asset('css/core.css')}}">没有授予正斜杠,但对我来说很好。 -
我已经尝试了所有方法,但它根本不起作用:(
-
您确定您的文件位于 public/assets/global/plugins/font-awesome/css/ 中吗?您在 config/app.php 中正确设置了您的应用程序 url 吗?
-
我没有检查我的 app.php 如何解决这个问题?提前非常感谢你