15,064
edits
m (→使用者操作/使用者輸入的內容) |
|||
| Line 12: | Line 12: | ||
* 空值 ex: 空白、全形空白、NULL、0000-00-00 | * 空值 ex: 空白、全形空白、NULL、0000-00-00 | ||
* 文字字串間夾雜空白 | * 文字字串間夾雜空白 | ||
* | * 輸入文字內容的前後有額外的空白。處理方式: | ||
** 可用 [http://php.net/manual/en/function.trim.php rim] 函數處理。陣列元素值則搭配 [http://php.net/manual/en/function.array-map.php array_map] 函數處理。ex: {{kbd | key = <nowiki>$trimmed_array = array_map('trim' ,$array);</nowiki>}}<ref>[http://stackoverflow.com/questions/5762439/how-to-trim-white-spaces-of-array-values-in-php How to trim white spaces of array values in php - Stack Overflow]</ref> | ** PHP: 可用 [http://php.net/manual/en/function.trim.php rim] 函數處理。陣列元素值則搭配 [http://php.net/manual/en/function.array-map.php array_map] 函數處理。ex: {{kbd | key = <nowiki>$trimmed_array = array_map('trim' ,$array);</nowiki>}}<ref>[http://stackoverflow.com/questions/5762439/how-to-trim-white-spaces-of-array-values-in-php How to trim white spaces of array values in php - Stack Overflow]</ref> | ||
** jQuery [http://api.jquery.com/jQuery.trim/ $.trim('string')] | ** 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] | ||
* 超出預期的內容長度 | * 超出預期的內容長度 | ||