5.0.0 - 普通 - 已处理
public function index()
{
return redirect('hello')->with('name','thinkphp');
}
public function hello()
{
$name = session('name');
dump($name);die;
}输出Call to a member function flash() on null修改think\response\Redirect.phpuse think\Request;
use think\Response;
use think\Route;
use think\session;
/**
* Redirect Response
*/
class Redirect extends Response
{
protected $options = [];
// URL参数
protected $params = [];
protected $route;
protected $request;
public function __construct(Route $route,session $session,Request $request, $data = '', int $code = 302)
{
parent::__construct($data, $code);
$this->route = $route;
$this->request = $request;
$this->session = $session;
$this->cacheControl('no-cache,must-revalidate');
}完美解决如果爆
invalid request:index/hello说明默认的路由的问题Route::get('/hello/:name', 'index/hello');只需要默认路由中这段加入/既可以Route::get('/hello/:name', '/index/hello'); 