更新时间:2022-05-07 23:35:30
asset()助手将基本URL附加到您提供的路径中. 但是laravel将js,css和图像文件保存在 public 文件夹中,因此您需要添加以下公共路径:
The asset() helper prepends the base URL to the path you supply. But laravel keep js, css, and image files into public folder so you need to add public path like this:
href="public/{{ asset('css/style.css') }}.
而不是对此文件进行- vendor\laravel\framework\src\Illuminate\Foundation\helpers.php
function asset($path, $secure = null)
{
if($_SERVER['HTTP_HOST']=='127.0.0.1:8000')
return app('url')->asset($path, $secure);
else
return app('url')->asset('public/'.$path, $secure);
}