Ank*_*kit 4 php laravel laravel-5.7
我是laravel的新手。我在本地系统上设置了 laravel 5.7 并将 js 和 css 放入公共文件夹,但是当在浏览器上点击我的站点 url 时,站点没有加载任何 css 和 js。
网站结构:
app
bootstrap
config
database
public
-css
-js
-images
resources
-views
-includes
-layouts
-pages
routes
tests
vendor
index.php
server.php
.env
Run Code Online (Sandbox Code Playgroud)
Note : I have cut .htaccess and index.php files and put these on root to run site without public in path.
Here is how I am calling url : CSS :
{{ URL::asset('css/style.css') }}
Run Code Online (Sandbox Code Playgroud)
JS :
{{ URL::asset('js/query-1.11.1.min.js') }}
Run Code Online (Sandbox Code Playgroud)
When seeing source code, the url looks like this :
http://localhost/mysite/css/style.css
Run Code Online (Sandbox Code Playgroud)
So can anybody help me out from this issue ?
Thanks in advance.
该asset()助手预先考虑基础URL给你提供路径。
基本 URL 是 index.php 的位置(在本例中:http://localhost/mysite/)。
如果您不想在 /public 中使用 index.php,则需要在资产路径中使用 public/ ,如下所示:
asset("public/css/style.css")
Run Code Online (Sandbox Code Playgroud)
js文件也一样,希望你理解。
| 归档时间: |
|
| 查看次数: |
19566 次 |
| 最近记录: |