【问题标题】:laravel asset file not lodded after copy .htaccess and index.php from public to root directory将 .htaccess 和 index.php 从公共复制到根目录后,laravel 资产文件未加载
【发布时间】:2018-10-23 18:41:39
【问题描述】:

这是我的源代码。我是 laravel 的新手,请我解决问题

<link href="http://localhost/eccomece/css/style.css" rel="stylesheet" type="text/css" media="all" />

【问题讨论】:

    标签: php laravel css


    【解决方案1】:

    你只需要更新asset()方法... 进入这个目录 C:\xampp\htdocs\detox\vendor\laravel\framework\src\Illuminate\Foundation\helper.php

    并像下面这样更新asset()函数:

    function asset($path, $secure = null)
        {
            if ($_SERVER['HTTP_HOST']=='127.0.0.1:8000')
                return app('url')->asset($path, $secure);
            if ($_SERVER['HTTP_HOST']=='localhost:8000')
                return app('url')->asset($path, $secure);
            else
                return app('url')->asset('public/'.$path, $secure);
        }
    

    【讨论】:

      猜你喜欢
      • 2015-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-02
      • 2013-06-03
      • 2018-02-13
      • 1970-01-01
      • 2017-09-25
      相关资源
      最近更新 更多