我的知识记录

请问解决 PbootCMS 附件上传报错

根据你提供的信息,PbootCMS 附件上传时报错:

    上传失败:UNKNOW: Code: 8192; Desc: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior; File: /www/wwwroot/aaa.xxxx.com/core/function/file.php; Line: 176;

错误提示表明 stripos() 函数的第二个参数 $ext 不是一个字符串,而是一个字符。为了解决这个问题,需要确保 $ext 是一个字符串。

解决步骤

  1. 打开 file.php 文件

    • 使用文本编辑器或 IDE 打开 /www/wwwroot/aaa.xxxx.com/core/function/file.php 文件。
  2. 查找并修改代码

    • 找到第 176 行附近的代码: php   if (stripos($types, $ext) !== false)
    • 将其修改为: php   if (stripos($types, (string)$ext) !== false)

    解释:

    • chr($ext) 期望 $ext 是一个整数(ASCII 值),这不符合实际情况,因为 $ext 应该是一个字符串(如 'jpg''png' 等)。
    • (string)$ext 将 $ext 显式地转换为字符串,确保 stripos() 函数的第二个参数是一个字符串。
  3. 保存文件

    • 保存对 file.php 文件的修改。
  4. 测试上传功能

    • 尝试再次上传附件,确认问题是否解决。

标签:pbootcms插件-pbootcms安装教程-pbootcms标签-pbootcms模板-pbootcms修改模板工具-

更新时间:2025-04-11 01:54:45

上一篇:请问如何修改PHP网站的页面代码?

下一篇:请问解决DEDE图集上传图片时跳出302错误,有时可以上传有时不行