Tp5在Linux部署报错During inheritance of JsonSerializable: Uncaught think\exception\ErrorException

问题描述:tp项目在本地调试没有任何问题,在linux第一次调试也莫有问题;后来xampp升级忘记备份了 就出现了这个问题。 

Tp5在Linux部署报错During inheritance of JsonSerializable: Uncaught think\exception\ErrorException_第1张图片

报错信息翻译后:

在JsonSerializable的继承过程中:
未捕获think\exception\ErrorException:返回类型属于think\Model::jsonSerialize()两者都应该与JsonSerializable::jsonSerialize():混合的,
或应使用【返回类型将改变】属性应用于临时抑制中的通知 

发现这个报错信息也不能基于全部,以后还是要减少对debug的依赖。

尝试了修改use think\Exception 改为use Exception 和替换整体think文件 更新apache 在nginx测试都莫有效果 还是要坚信think包不会有问题的 有问题的还是自己的代码

最后没有办法了,开始从接口一步步走 发现在调取系统Model返回的类型不正确;尝试修改了一下use think\Model 换成了 use think\console\command\make\Model 成功解决了这个问题;就是在引入的时候没有引入成功。在windows上莫有任何问题 在linux这方面是比较严格。

Tp5在Linux部署报错During inheritance of JsonSerializable: Uncaught think\exception\ErrorException_第2张图片


2022.4.6在次遇到这种类似问题 发现最终问题是php的版本太高8.1以上

解决办法:During inheritance of Iterator: Uncaught think\exception\ErrorException: Return type of_荒-漠的博客-CSDN博客tp5项目在本地运行没有问题,在linux上报错其实不是linux的问题 ,最后发现是本地和线上linux部署的环境不同才导致这种问题tp5在php版本8.1以上会出现好多不兼容的问题 ,最好的解决办法就是给php进行降级操作During inheritance of Iterator: Uncaught think\exception\ErrorException: Return type of PhpOffice\PhpSpreadsheet\Worksheet\Iterator::val.https://blog.csdn.net/qq5201314wx/article/details/123990897

你可能感兴趣的:(php,linux,linux,php)