顯示具有 PHP Function 標籤的文章。 顯示所有文章
顯示具有 PHP Function 標籤的文章。 顯示所有文章

PHP 去除HTML和PHP標籤 - strip_tags


去除字串中的HTML和PHP標籤

PHP 取得字元長度


strlen、mb_strlen、mb_strwidth 取得字元長度

PHP 字串取代 - str_replace

str_replace ( 要被取代的字串 , 拿來代換的字串 , 被搜尋的字串 )

如 str_replace("BB", "DD", "AA BB CC");

結果為 AA DD CC

PHP - addslashes stripslashes

addslashes() 對特殊字元增加的反斜線


如:addslashes("O'reilly")
取得值為 O\'reilly

stripslashes() 去除由 addslashes() 增加的反斜線

如: stripslashes ("O\'reilly")
取得值為 O'reilly

PHP 輸入字串轉換 - htmlspecialchars



htmlspecialchars ( string $string [, int $quote_style = ENT_COMPAT [, string $charset [, bool $double_encode = true ]]] )

PHP 擷取中文字


只要PHP.INI檔裡有使用mbstring的擴充功能,便可使用mb_substr()的函式