Controller.php 763 字节
<?php

namespace App\Http\Controllers;

use App\Fun;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;



    /**
     * 非本站链接,中转跳转
     * @author:dc
     * @time 2023/1/16 9:22
     */
    public function redirect(){
        $url = urldecode(request()->get('url'));

        if(empty($url)){
            Fun::abort();
        }

        if(!preg_match("/^http(s?):\/\//",$url)){
            $url = 'http://'.$url;
        }


        return redirect($url,302);
    }


}