PHP开发中的错误收集,不定期更新。

yipeiwu_com6年前PHP代码库
Fatal error: Non-static method Conn::__construct() cannot be called statically in /file.php

没有静态的方法(里面这个指方法参数,字符串类型),不能从静态上下文引用。

Fatal error: [] operator not supported for strings in /file.php

当一个变量已设为非数组类型的时候,就不能再次使用[]让同名变量增加数据键值
解决方法:1.改变变量名称、2.使用$var = array(...)
举例:
复制代码 代码如下:

//这里为字符串类型
$err = $e->getMessage();

//当执行到这里的时候会报错
$err[] = array
(
'gid' => $this->_get['id'],
'url' => $new,
'log' => $err,
'time' => time()
);

Fatal error: Declaration of Listing::content() must be compatible with that of InewsList::content() in file\List_1.php on line 7

统一接口所有类方法都必须和接口规定的一致:作用域声明、方法名、参数数量

Warning: mysqli::query() [mysqli.query]: Couldn't fetch Insert in /file.php

必须使用mysqli链接数据库后返回的结果集去执行操作。

Warning: 1064_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...

网上搜索是MYSQL兼容问题,实际操作上是语法错误,需检查SQL语句写的是否正确。

Warning: array_shift() expects parameter 1 to be array, integer given

函数第一个参数必须是一个数组。

#1366 - Incorrect integer value: '' for column 'ID' at row 1

mysql版本为msyql 5.1.14 WIN32版本,出现错误的原因是没有给自增ID赋值,尽管之前的版本可以不赋值,自动增加,但是在新版本的msyql中需要为其赋值NULL

#1136:Column count doesn't match value count at row 1

检查一下有没有序号自增加的字段。
所存储的数据与数据库表的字段类型定义不相匹配.
字段类型是否正确, 是否越界, 有无把一种类型的数据存储到另一种数据类型中.

#1062_Duplicate entry '...' for key 'map'

关键字重复、可能是主键ID、也可能是唯一字段。

相关文章

is_uploaded_file函数引发的不能上传文件问题

起因: 在一个项目中,接到用户反馈说其所有客户不能上传文件,都返回失败。经过排查发现是PHP中的is_uploaded_file函数在捣鬼。 细节分析: 在正常情况下,通过PHP 上传文...

php array_intersect()函数使用代码

array array_intersect ( array array1, array array2 [, array ...]) array_intersect() 函数返回两个或多个...

使用ETags减少Web应用带宽和负载第1/2页

介绍 最近,大众对于REST风格应用架构表现出强烈兴趣,这表明Web的优雅设计开始受到人们的注意。现在,我们逐渐理解了“3W架构(Architecture of the World W...

php操作sqlserver关于时间日期读取的小小见解

上周五,要做一个php 同时对mysql数据库和sqlserver数据库的连接东东 以前一直在用mysql对sqlserver不是很熟悉,于是摸着石头过河。没有别的至少mysql和sql...

PHP错误提示It is not safe to rely on the system……的解决方法

在php程序开发中有时会出现类似于这样的警告: PHP Warning: date(): It is not safe to rely on the system's timezone...