yii\base\ErrorException 标签归档 - 永夜 https://www.shuijingwanwq.com/tag/yiibaseerrorexception/ 没有不值得去解决的问题,也没有不值得去学习的技术! Sun, 09 Aug 2026 12:37:40 +0000 zh-Hans hourly 1 https://wordpress.org/?v=7.1 https://media.shuijingwanwq.com/2026/05/logo-150x150.png yii\base\ErrorException 标签归档 - 永夜 https://www.shuijingwanwq.com/tag/yiibaseerrorexception/ 32 32 在 Yii2 中,使用关联查询时,报错:yii\base\ErrorException: Undefined index: id in \vendor\yiisoft\yii2\db\ActiveRelationTrait.php:554 https://www.shuijingwanwq.com/2025/06/10/9114/ Tue, 10 Jun 2025 02:06:37 +0000 https://www.shuijingwanwq.com/?p=9114 针对在 Yii2 中使用关联查询报错 yii\base\ErrorException: Undefined index: id 的问题,经排查确认生成的 SQL 执行无误。尝试删除 asArray() 方法可消除报错,但无法获取 count 值。最终采用更可靠的 leftJoin 方案进行替代,成功解决了报错问题并满足数据统计需求。

在 Yii2 中,使用关联查询时,报错:yii\base\ErrorException: Undefined index: id in \vendor\yiisoft\yii2\db\ActiveRelationTrait.php:554最先出现在永夜

]]>
在 Yii2 中,file_get_contents(“https://api.weixin.qq.com”); 时报错:yii\base\ErrorException: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: https://www.shuijingwanwq.com/2025/04/21/8981/ Mon, 21 Apr 2025 03:38:50 +0000 https://www.shuijingwanwq.com/?p=8981 在 Yii2 中使用 file_get_contents 请求微信接口时报错 SSL operation failed。文章分析了该问题由于 CA 证书缺失或配置错误导致,尝试在 php.ini 中配置 openssl.cafile 并重启服务后仍未解决。最终通过基于 curl 重新实现请求逻辑,成功绕过了 SSL 验证问题并解决了报错。

在 Yii2 中,file_get_contents(“https://api.weixin.qq.com”); 时报错:yii\base\ErrorException: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:最先出现在永夜

]]>
容器的基础镜像更换后,PHP Core Warning ‘yii\base\ErrorException’ with message ‘Module ‘gd’ already loaded’ https://www.shuijingwanwq.com/2021/11/16/5492/ Tue, 16 Nov 2021 02:40:47 +0000 https://www.shuijingwanwq.com/?p=5492 容器更换基础镜像后,在特定 Rancher 环境变量开启时启动失败并提示模块已加载。经排查,原因为命令行执行时重复加载了 gd、exif 和 sockets 扩展。最终通过修改 Dockerfile,利用 sed 命令从配置文件中删除对应扩展的加载项,解决了重复加载报错问题,确保了容器在环境变量开启时成功启动。

容器的基础镜像更换后,PHP Core Warning ‘yii\base\ErrorException’ with message ‘Module ‘gd’ already loaded’最先出现在永夜

]]>
在 Yii 2.0 中报错:yii\base\ErrorException: Undefined index: HTTP_ACCEPT https://www.shuijingwanwq.com/2020/01/21/3914/ Tue, 21 Jan 2020 06:13:09 +0000 https://www.shuijingwanwq.com/?p=3914 本文记录了解决 Yii 2.0 报错 yii\base\ErrorException: Undefined index: HTTP_ACCEPT 的过程。通过查看运行时日志发现,当 User-Agent 为 okhttp/3.12.0 时,$_SERVER 数组中不存在 HTTP_ACCEPT 索引。解决方法是要求 Android 客户端在 Headers 中明确声明 Accept 参数,或者在服务端代码中增加判断,当该索引不存在时不直接使用,从而消除错误。

在 Yii 2.0 中报错:yii\base\ErrorException: Undefined index: HTTP_ACCEPT最先出现在永夜

]]>