下面thinkphp框架教程栏目将给大家讲介绍关于thinkphp6不能用redirect重定向的问题,希望对需要的朋友有所帮助!
TP6在__construct和_initialize中无法使用redirect重定向?
说明
目前版本 return redirect('index/index'); 在__construct和_initialize无法使用,可以安装之前的代码方便使用
立即学习“PHP免费学习笔记(深入)”;
安装
composer require liliuwei/thinkphp-jump
用法示例
<?php namespace app\controller; class Index { use \liliuwei\think\Jump; public function index() { //return $this->error('error'); //return $this->success('success','index/index'); //return $this->redirect('/admin/index/index'); return $this->result(['username' => 'liliuwei', 'sex' => '男']); } }
推荐:《最新的10个thinkphp视频教程》
以上就是thinkphp6不能用redirect重定向是什么情况?的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号