PHP错误问题收集

1. Function get_magic_quotes_gpc() is deprecated

 原因: php版本于7.4开始此方法已被弃用

 解决方案: ini_get('magic_quotes_gpc') 的值判断

 // 结果和 get_magic_quotes_gpc()的结果等效
$get_magic_quotes_gpc = (($quotes_gpc = ini_get('magic_quotes_gpc')) && strtolower($quotes_gpc) !== 'off');

相关信息: magic_quotes_gpc 、 magic_quotes_runtime、 magic_quotes_sybase 区别

magic_quotes_gpc 默认 on (< 5.3之前)

作用:对输入的GET、POST、COOKIE的数据自动转义

magic_quotes_runtime 默认值 off

作用:对从外部读取的数据自动进行转移,例如:读数据库、读文件等

magic_quotes_sybase  默认off

作用:影响 addslashes() 函数。
magic_quotes_sybase=0 时,addslashes 将对 ' " \ 进行 \ 转义操作;
magic_quotes_sybase=1 时,addslashes 将对 ' 进行 '' 转义操作(两个单引号)。

2.  mysqli::__construct(): (HY000/2002): Connection refused

原因: 连接不上MYSQL服务器

3. call_user_func_array() expects parameter 1 to be a valid callback, no array or string given

原因:调用函数时传递的参数有误,第一个参数不是一个有效的回调  

解决:检查调用函数处的参数值是否有效

扫描二维码关注公众号,回复: 15005770 查看本文章

4. mysqli::__construct(): (HY000/1045): Access denied for user ''@'127.0.0.1' (using password: YES)

原因: 不能使用空密码连接MYSQL服务器

解决: 检查数据库连接配置

5.  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

原因:  SQL语法有问题

6.addslashes() expects parameter 1 to be string, array given

 原因:参数类型错误,参数应该是字符串而不是数组

7. Header may not contain more than a single header, new line detected

 原因: header头信息内存在不合法的字符 \n 换行符

 解决方案: 检查header输出的内容,如果出现不合法的字符可以去掉或编码

8. Cannot destroy the zip context: Can't remove file: No such file or directory

原因: ZipArchive类实例化后,不添加任何文件或目录时,也会报错

9.  strpos 函数如果传递的是数组array类型, 结果并不会返回false

后续继续补充...

其他资料:

 1.  php.ini文件详细介绍 PHP配置文件详解php.ini - 天真無邪 - 博客园 (cnblogs.com)

猜你喜欢

转载自blog.csdn.net/u010336468/article/details/124124891