Url

作者: 爱折腾的傻小子 | 来源:发表于2018-10-29 11:02 被阅读5次
  • url() 方法
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实例

相关文章

网友评论

      本文标题:Url

      本文链接:https://www.haomeiwen.com/subject/tymlvxtx.html