thinkphp6不能用redirect重定向是什么情况?

下面thinkphp框架教程栏目将给大家讲介绍关于thinkphp6不能用redirect重定向的问题,希望对需要的朋友有所帮助!

thinkphp6不能用redirect重定向是什么情况?

TP6在__construct和_initialize中无法使用redirect重定向?

说明

目前版本 return redirect(‘index/index’); 在__construct和_initialize无法使用,可以安装之前的代码方便使用

立即学习PHP免费学习笔记(深入)”;

安装

composer require liliuwei/thinkphp-jump

用法示例

<?php namespace appcontroller; class Index  {     use liliuweithinkJump;      public function index()     {         //return $this->error('error');         //return $this-&gt;success('success','index/index');         //return $this-&gt;redirect('/admin/index/index');         return $this-&gt;result(['username' =&gt; 'liliuwei', 'sex' =&gt; '男']);       } }

推荐:《最新的10个thinkphp视频教程》

© 版权声明
THE END
喜欢就支持一下吧
点赞12 分享