分享PHP錯誤提示解釋_PHP教程

來源:互聯網
上載者:User
在學習PHP的時候, 經常遇到各種錯誤提示,今天看到這錯誤提示和解釋感覺挺好,現轉過來,供我們學習。呵呵。。。。。
1、Notice: Undefined variable: 變數名in
註:使用了一個沒有被定義的變數
2、Parse error: syntax error, unexpected T_ELSE in
If () {
}Else if () {
}
Echo $test;
Else {
}
註:是if else if else 句式錯誤
3、Parse error: syntax error, unexpected $end in D
註:一般是大括弧不匹配
4、Parse error: syntax error, unexpected T_STRING in
註:一般是忘了寫句末分號
5、Warning: Invalid argument supplied for foreach() in
註:foreach 的第一個參數必須是一個數組
6、Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in
註:這說明前面執行SQL 返回失敗,一般可能是SQL語句 錯誤 ,如分析 不出來,剛可以列印出Mysql_error (); 看具體是哪個地方錯了
7、No database selected
註:一般是沒有串連資料庫
8、Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘root’@'localhost’(using password: YES) in ….. on line 3
Access denied for user ‘root’@'localhost’ (using password: YES)
註:資料庫使用者名稱密碼錯
9、Unknown database ‘cms07261′
註:沒有這個資料庫
10、Table ‘cms0726.test’doesn’t exist
註:表不存在
11、Unknown column ‘abc’in ‘field list’
註:欄位不存在
12、Column count doesn’t match value count at row 1
註:sql語句中 欄位值的個數比欄位名個數不一樣
13、Warning: Wrong parameter count for 函數名in
註:函數對數個數 少了
14、Fatal error: Smarty error: [in message_list.html line 22]: syntax error: ‘foreach: item’must be a variable name (literal string)
註:看行號,說明foreach 後面的item 後面必須跟一個變數名,不加$,是一個字串(註:沒有單雙引)
15、Fatal error: Smarty error: [in message_list.html line 24]: syntax error: unrecognized tag: msg.message_id
註:模板中 變數前缺少$
16、
Warning: Smarty error: unable to read resource: “message_list1.html” in
註:模板檔案找不到,看是否是檔案名稱寫錯或檔案存放到別的目錄中去了。
17、Fatal error: Cannot redeclare get_sort1() (previously declared in
註:函數已經定義過, 不能重新再定義

http://www.bkjia.com/PHPjc/478441.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478441.htmlTechArticle在學習PHP的時候, 經常遇到各種錯誤提示,今天看到這錯誤提示和解釋感覺挺好,現轉過來,供我們學習。呵呵。。。。。 1、Notice: Undef...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.