Laravel 5重定向功能源代码

时间:2017-04-28 14:02:34

标签: php laravel

Laravel 5 redirect函数源代码在哪里?

我使用ag "function redirect"搜索定义的位置,但我什么都没有。

所以我想知道它在哪里,为什么以及如何。

2 个答案:

答案 0 :(得分:1)

它位于vendor/laravel/framework/src/Illuminate/Foundation/helpers.php

function redirect($to = null, $status = 302, $headers = [], $secure = null)
{
    if (is_null($to)) {
        return app('redirect');
    }

    return app('redirect')->to($to, $status, $headers, $secure);
}

答案 1 :(得分:0)

因为ag忽略了vcs忽略(.gitignore,.hgignore;仍然服从.ignore),现在我得到了我想要的东西:使用ag --php --skip-vcs-ignores "function redirect\("

vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
604:    function redirect($to = null, $status = 302, $headers = [], $secure = null)

vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php
30:    public function redirect($path, $route, $scheme = null);

vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php
22:    public function redirect($path, $route, $scheme = null)