Url

2018-10-29  本文已影响5人  爱折腾的傻小子
if (! function_exists('url')) {
    /**
     * Generate a url for the application.
     *
     * @param  string  $path               # url 路径
     * @param  mixed   $parameters  # 参数设置
     * @param  bool    $secure           # null = false => http | true => https
     * @return \Illuminate\Contracts\Routing\UrlGenerator|string
     */
    function url($path = null, $parameters = [], $secure = null)
    {
        if (is_null($path)) {
            return app(UrlGenerator::class);
        }

        return app(UrlGenerator::class)->to($path, $parameters, $secure);
    }
}
# url() 方法使用示例
url(); // 返回一个容器解析的UrlGenerator::class实例
上一篇 下一篇

猜你喜欢

热点阅读