laravel 加载资源失败:服务器响应状态为 404(未找到)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29614890/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 16:57:27  来源:igfitidea点击:

Failed to load resource: the server responded with a status of 404 (Not Found)

laravellaravel-4

提问by mangulom

http://localhost:8080/asset/js/boostrap.min.jsFailed to load resource: the server responded with a status of 404 (Not Found)

http://localhost:8080/asset/js/boostrap.min.js加载资源失败:服务器响应状态为 404(未找到)

In my folder asset/js/

在我的文件夹 asset/js/

I′ve the file boostrap.min.js

我有文件 boostrap.min.js

What′s the problem?

有什么问题?

回答by georgeok

There are many reasons you get a file not found exception. The most popular is the file permissions. If you are on UNIX try chmod -R 777in the folder that contains bootstrap.min.js. If this doesn't works you have to review the server conf files or the .htaccess files.

出现文件未找到异常的原因有很多。最流行的是文件权限。如果您使用 UNIX,请尝试 chmod -R 777在包含 bootstrap.min.js 的文件夹中。如果这不起作用,您必须查看服务器配置文件或 .htaccess 文件。

If you want a "just works solution" include the bootstrap from a cdn.

如果您想要一个“正常工作的解决方案”,请包括来自 CDN 的引导程序。

<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"></script>

If none of the above works for you please post your .htaccess contents from the directory which bootstrap is located.

如果以上都不适合您,请从引导程序所在的目录中发布您的 .htaccess 内容。

回答by Merhawi Fissehaye

Use

<script src="{{URL::asset('asset/js/bootstrap.min.js')}}"></script>

instead

反而

回答by Jlcanizales

try {{ HTML::script('asset/js/boostrap.min.js') }}and put the boostrap.min.js into the public/asset/js folder

尝试{{ HTML::script('asset/js/boostrap.min.js') }}将 boostrap.min.js 放入 public/asset/js 文件夹

回答by Scott Tang

I was having a problem with simply referencing app.cssand this worked:

我在简单引用时遇到了问题,app.css这很有效:

link rel="stylesheet" href="{{('css/app.css')}}"

I'm not exactly sure why the {{}}around css/app.cssworks. I didn't have the braces before and got error 404. Can someone explain why the braces resolve the not found 404 error?

我不完全确定为什么{{}}周围css/app.css工作。我之前没有戴牙套,但得到了error 404. 有人可以解释为什么大括号可以解决not found 404 error?