Thinkphp6.0下载:(本地)
https://www.jsdaima.com/blog/205.html
5.1-6.0升级指导
https://www.kancloud.cn/manual/thinkphp6_0/1037654
http://www.thinkphp.cn/topic/68460.html (多步骤)
报错控制器错误:
Thinkphp6.0 多应用安装说明(think-multi-app)扩展:
https://www.tqwba.com/x_d/jishu/111015.html
driver [think] not supported (think-view) 扩展
https://blog.csdn.net/u011242029/article/details/102987433
composer require topthink/think-image
composer require topthink/think-installer
composer require topthink/think-migration
composer require topthink/think-mongo
composer require topthink/think-oracle
composer require topthink/think-queue
composer require liliuwei/thinkphp-jump ($this->error)
1 | db,cookie,类引入: (use think\Model;不变) |
方法不存在app\admin\controller\login->index()
访问url错误
thinkphp6 视图 tpl_replace_string 使用不了的解决方案
1、请查看是否安装模块 topthink/think-template,tp6开始很多模块都是独立出来的。
2、在 config/view.php 添加 tpl_replace_string,属性,如下图所示:
https://www.yii666.com/Uploads/ueditor/image/20201017/1602902852167850.png
3、清理缓存!!!【重要】
‘tpl_cache’ =>false,
tp6的验证码配置是通过root/config/captcha.php配置文件调用的。
tp5 application/config.php
http://www.thinkphp.cn/topic/64424.html
think\Controller类取消
系统不再提供基础控制器类think\Controller,原来的success、error、redirect和result方法需要自己在基础控制器类里面实现。
系统默认在应用目录下面提供了一个app\BaseController基础类,或者你可以直接放入你的应用里面,继承使用。
你可以安装下面的扩展用于支持旧版本的跳转操作
1 | composer require liliuwei/thinkphp-jump |
https://blog.csdn.net/weixin_45624316/article/details/104556118
验证码
https://blog.csdn.net/DickyQie/article/details/105764540
https://www.jianshu.com/p/a81867792257
位数length
字符大小fontSize
tp6 SESSION用法
https://www.jianshu.com/p/6f385b35581c
tp6 数据库查询
tp6 没有tp5的self:get(数组)
替代 where(数组)
https://www.cnblogs.com/sam-zh/p/15196390.html
https://blog.csdn.net/zy1281539626/article/details/110313357
控制器访问model方法,返回error
1 | login.php: |
全局变量(放在入口文件)
1 | define('APP_PATH',__DIR__.'/../app'); |
tp6 获取请求的模块名、类名和方法名(MODULE_NAME)
https://blog.csdn.net/haibo0668/article/details/117604658
设置位置 : app\common\controller\Common.php下
tp6 继承基础类
(app\admin\controller\base.php extends app\basecontroller.php )
(app\admin\controller\index.php extends app\admin\controller\base.php)
parent::_initialize不执行 base.php有后台页面都要加载的数据
去掉了initialize的_
indirect modification of overloaded element of think\coltroller has no effect
https://www.cnblogs.com/richerdyoung/p/12144692.html
取消setField方法
取消Query类的setField方法,请直接使用data方法或者update方法。
[PHP时间戳和日期相互转换]
https://www.cnblogs.com/wuhuan666/p/8472911.html
MySQL时间戳和时间的获取/相互转换/格式化
https://blog.csdn.net/lilongsy/article/details/79061639
collection (助手函数实现数据集对象的转换 )函数错误
tp6取消了collection,直接->toarray()即可
tp6如何获取表前缀 config(‘database.prefix’); 打印是null
http://www.thinkphp.cn/topic/68848.html
tp6如果你需要生成多个不同设置的验证码,可以使用下面的配置方式
tp5 如果你需要在一个页面中生成多个验证码的话,entry方法需要传入可标识的信息,例如:
1 | $captcha = new Captcha(); |
tp6 : https://www.kancloud.cn/manual/thinkphp6_0/1246402
空操作
1 | 基础类下: |
重定向
重定向传参
如果是站内重定向的话,可以支持URL组装,有两种方式组装URL,第一种是直接使用完整地址(/打头)
1 | redirect('/index/hello/name/thinkphp'); |
cannot redeclare static think\model::$db as non static app\game\model\Eventm::$db
model下连接多个服务器(protected $db,改名字 )
Db::connect($data);$$data只支持字符串,数组报错
https://blog.csdn.net/haibo0668/article/details/117826377
[不支持reids]
项目php下开启redis扩展
(https://segmentfault.com/q/1010000013021566)
http://www.thinkphp.cn/topic/68472.html
TP5或6.0Indirect modification of overloaded element of think\Collection has no effect(这个问题一般出现在给对象循环赋值的时候出现。 )
https://blog.csdn.net/qq_41399976/article/details/101440493
数据库查询出数据->toArray();
array_column() 函数
Malformed UTF-8 characters, possibly incorrectly encoded
https://blog.csdn.net/qq_34228881/article/details/82620506
- 本文作者: LQbank
- 本文链接: http://example.com/2021/10/08/Thinkphp5升级6(游戏后台项目)/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!