PHP開發中的錯誤收集,不定期更新。_php技巧

來源:互聯網
上載者:User
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、也可能是唯一欄位。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.