Controller.php
763 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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);
}
}