laravel构造函数跳转失败
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class CommonController extends Controller
{
public function __construct(Request $request){
if(!$request->session()->has('user_info')) {
redirect('/login')->send();
}else{
$this->check_auth();
}
}
public function check_auth(){
redirect('/')->send();
}
}
注意:不能使用return 来跳转,正确跳转写法:redirect('/login')->send();