what does @url do?



我在ajax请求调用部分中遇到了这个@url

$.ajax({
       type: "POST",
       url: "{{ @url("/accounts/upload-sf/validate") }}",
       data: formData,
       cache: false,
       contentType: false,
       processData: false,
       success: function(response_json) { ...

@urlurl有什么不同吗?

Custom Laravel指令。可以创建要在边栏选项卡模板中使用的自定义函数。https://laravel.com/docs/5.8/blade#extending-blade

请参阅方法签名:

if (! function_exists('url')) {
/**
 * Generate a url for the application.
 *
 * @param  string  $path
 * @param  mixed   $parameters
 * @param  bool    $secure
 * @return IlluminateContractsRoutingUrlGenerator|string
 */
function url($path = null, $parameters = [], $secure = null)
{
    if (is_null($path)) {
        return app(UrlGenerator::class);
    }
    return app(UrlGenerator::class)->to($path, $parameters, $secure);
}

}

最新更新