laravel 解决NGINX显示ip和端口的问题

2019-07-16  本文已影响0人  老陈的记事本

第一步:.env增加配置:

ASSET_URL=//xxx.aliyun.com

备注:该值会指定模板中使用的{{asset('static')}}

第二步:修改helpers.php

原本代码:

function url($path = null, $parameters = [], $secure = null)
    {
        if (is_null($path)) {
            return app(UrlGenerator::class);
        }
        return app(UrlGenerator::class)->to($path, $parameters, $secure);
    }

修改后代码:

function url($path = null, $parameters = [], $secure = null)
    {
        if (is_null($path)) {
            return app(UrlGenerator::class);
        }
        $url=app(UrlGenerator::class)->to($path, $parameters, $secure);
        return str_replace('http://61.10.10.16:61135','',$url);
    }

大功告成

上一篇 下一篇

猜你喜欢

热点阅读