我的CSS和JS文件在本地主机上的公共文件夹中,但它不工作。我使用的是laravel 5.2。我尝试了很多方法,但还是失败了。
我不想用,<link href="{{asset('/css/app.css')}}" rel="stylesheet">
我使用:
<link href="public/css/app.css" rel="stylesheet">
但它不起作用。请给我一个解决方案。我该怎么做呢?
谢谢。
发布于 2018-09-20 12:52:17
您首先需要在您的公共文件夹中创建assets文件夹,然后将 css 文件夹和所有css文件放入其中,然后像这样链接它:
<link href="assets/css/app.css" rel="stylesheet">希望能对你有所帮助!
有关view的更多信息,请访问此
根据评论更新
使用以下命令检查您的.htaccess文件
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /public/$1
#RewriteRule ^ index.php [L]
RewriteRule ^(/)?$ public/index.php [L]
</IfModule>希望这能行得通
https://stackoverflow.com/questions/52417511
复制相似问题