laravel 5.3 托管问题 - 无法加载 css
laravel 5.3 hosting issue - not loading css
我正在尝试让我的 laravel 应用程序在 godaddy 上运行,我将 public 文件夹内容移动到根 public_html 文件夹并且应用程序启动并且 运行,这里是 link,css 文件,图像未加载。这是为什么?
当我在浏览器上使用 inspect element
时, 我的 link 到 css 文件给出了写入路径。但不是真的有效。
这里是 link 到 css 文件的代码:
<link href="{{ URL::asset('css/style.css')}}" rel="stylesheet">
我也试过:
<link href="{{ asset('css/style.css')}}" rel="stylesheet">
和:
<link href="{{ HTML::style('css/style.css')}}" rel="stylesheet">
none 在托管方面为我工作,但在本地主机上工作正常
我的图片代码为 link 图片:
{{ URL::asset('images/logo.png')}}
我认为这不是托管问题,您的 style.css 不存在于 css 文件夹中,图像文件夹中不存在图像。上传这些文件。
如果您在控制台中看到,您会发现 404 未找到错误。
style.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
logo.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
slide1.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
slide2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
financial.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
slide3.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
/favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
style.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
在主机上你应该输入主机上 public_html 文件夹的完整路径的问题
这是另一种处理缺失 js 和 css 文件的方法,如果文件存在但显示 404 错误
我正在尝试让我的 laravel 应用程序在 godaddy 上运行,我将 public 文件夹内容移动到根 public_html 文件夹并且应用程序启动并且 运行,这里是 link,css 文件,图像未加载。这是为什么?
当我在浏览器上使用inspect element
时,我的 link 到 css 文件给出了写入路径。但不是真的有效。
这里是 link 到 css 文件的代码:
<link href="{{ URL::asset('css/style.css')}}" rel="stylesheet">
我也试过:
<link href="{{ asset('css/style.css')}}" rel="stylesheet">
和:
<link href="{{ HTML::style('css/style.css')}}" rel="stylesheet">
none 在托管方面为我工作,但在本地主机上工作正常
我的图片代码为 link 图片:
{{ URL::asset('images/logo.png')}}
我认为这不是托管问题,您的 style.css 不存在于 css 文件夹中,图像文件夹中不存在图像。上传这些文件。 如果您在控制台中看到,您会发现 404 未找到错误。
style.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
logo.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
slide1.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
slide2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
financial.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)
slide3.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
/favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
style.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
在主机上你应该输入主机上 public_html 文件夹的完整路径的问题
这是另一种处理缺失 js 和 css 文件的方法,如果文件存在但显示 404 错误