Laravel 5个资产链接 [英] Laravel 5 assets links

查看:39
本文介绍了Laravel 5个资产链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试包含我的css或js文件以使用以下项目进行投影:

I try include my css or js files to project using:

{{ URL::asset('path to css') }}

{!! Html::style("path to css") !!}

或类似的

但是我总是从 public 目录获得链接.像这样: http://localhost/projectroot/public/assets/style.css

But i always got link from public directory. like so: http://localhost/projectroot/public/assets/style.css

为什么会发生这种情况,我该如何解决呢?

Why that happens and how can i solve this?

似乎我应该将自己的资产公开出售?

Seems to i should move my assets into public ?

推荐答案

使用助手 asset('path/to/css')

例如

<link rel="stylesheet" type="text/css" href="{{ asset('assets/style.css') }}">

假设您的 assets/style.css 处于公开状态

这篇关于Laravel 5个资产链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆