首页 > Laravel框架里, {{url}}和{{asset}}有什么不同?

Laravel框架里, {{url}}和{{asset}}有什么不同?

有的时候用这两个似乎都可以? 具体有什么不同呢?


asset()方法用于引入 CSS/JavaScript/images 等文件,文件必须存放在public文件目录下。
url()方法生成一个完整的网址。

参考:What is the difference between the two and in which cases I should use one or another?


function url($path = null, $parameters = [], $secure = null)
function asset($path, $secure = null)

一般asset用于引用静态文件 css js img 等

【热门文章】
【热门文章】