Troubleshooting of PHP errors: Difference between revisions

Jump to navigation Jump to search
Line 8: Line 8:
== 使用者輸入內容 ==
== 使用者輸入內容 ==
使用者輸入內容,內容可能是
使用者輸入內容,內容可能是
* 空值 <== 對策: [http://php.net/manual/en/function.trim.php PHP: trim] 或 jQuery [http://api.jquery.com/jQuery.trim/ $.trim('string')]
* 空值
* 包含特殊符號 ex: 單引號 ', 雙引號 ",  > < <== 對策: [http://www.php.net/manual/en/function.htmlentities.php PHP: htmlentities - Manual]
* 包含特殊符號 ex: 單引號 ', 雙引號 ",  > < <== 對策: [http://www.php.net/manual/en/function.htmlentities.php PHP: htmlentities - Manual]
* 包含換行符號
* 包含換行符號
* 內容的前後有空白 (可用[http://php.net/manual/en/function.trim.php trim]函數移除空白)
* 內容的前後有空白 <== 對策: [http://php.net/manual/en/function.trim.php PHP: trim] 或 jQuery [http://api.jquery.com/jQuery.trim/ $.trim('string')]
* 超出預期的內容長度
* 超出預期的內容長度
* (可勾選多個項目的狀況下) 指勾選了單一項目或者沒有勾選項目,就送出(submit)表格
* (可勾選多個項目的狀況下) 指勾選了單一項目或者沒有勾選項目,就送出(submit)表格

Navigation menu