tp6最新版重定向session给参问题

浏览:1474 发布日期:2021/03/31
5.0.0 - 致命 - 未处理
        /**
         * 重定向传参
         *  #  Route::get('demo4-test11/:id', 'demo4/test11')->cache(60); 
         *  #  http://up.xxx.com/demo4-test11/1 
         *  #  http://up.xxx.com/demo4/test11/
         */ 
        public function test11(){
            
            // return redirect('/index/index')->params(['name'=>'Tpshop-test11']);
            // Call to undefined method think\response\Redirect::params()
            
            // $name = session('name');
            // echo $name;
            
            // return redirect('/index/index/index')->with('name','thinkphp');
            // session 存储
            
            // return redirect('/demo4/test9')->with('name','thinkphp');
            // return redirect('index/demo4/hello')->with('name2','thinkphp');// 重定向次数过多
            return redirect((string)url('demo4/hello'))->with('name2','thinkphp');
            // http://up.xxx.com/demo4-test11/1  可以重定向  但是  session 不可用  去开启全局session试试
            // 关闭路由  访问  http://up.xxx.com/demo4/hello.html 可以重定向 session不可以  去开启全局session试试
            // http://up.xxx.com/demo4/hello
            
        }
        /**
         * 
         *  #  Route::get('demo4-hello/:id', 'demo4/hello')->cache(60); 
         *  #  http://up.xxx.com/demo4-hello/1 
         *  #  http://up.xxx.com/demo4/hello/
         */ 
        public function hello(){
            $name = session('name2');
            $name2 = input('param.name2');
            echo $name;
            echo ',hello,';
            echo $name2;
            
        }

       打印结果

      ,hello,
评论(
后面还有条评论,点击查看>>