php中幾個字元處理函數的說明_PHP教程

來源:互聯網
上載者:User
字串分割與串連函數:

代碼:
array explode(string delimiter, string data)使用字串 dellimiter 把 data 分割成一個數組返回
類似函數:split()代碼:
string implode(array data, string dellimiter)作用和explode()正好相反,把數組用dellimiter串連成一個長字串
函數別名:join()代碼:
array split(string pattern, string text[, integer limit])使用匹配模式pattern的字元作為分隔字元,把字串text分割成數組
limit 選擇性參數,限制分割的段數字串編解碼函數:代碼:
string addslashes(string text)在字串text中的特殊字元之前加“”返回,特殊字元包括 (), ("), ()。
類似函數:quotemeta()代碼:
string stripslashes(string text)和addslashes()函數正好相反,去掉反斜線編碼代碼:
string quotemeta(string text)類似於addslashes(),區別在於它的特殊字元包括: . + * ? [ ] ^ ( ) $代碼:
string escapeshellcmd(string command)在所有有可能在shell命令中引起麻煩的字元前加反斜線。
用於exec(), system()等函數之前。代碼:
string mysql_escape_string(string text)把一個SQL字串轉義,以安全用於mysql_query()HTML 相關函數代碼:
string htmlentities(string text)轉換所有HTML實體代碼:
string htmlspecialchars ( string string [, int quote_style [, string charset]])轉換特定字元為HTML實體
quote_style: (ENT_COMPAT|ENT_QUOTES)
quote_style預設值:ENT_COMPAT 轉換& < >
當quote_style為:ENT_QUOTES時,除轉換以上字元外還轉換 " and 代碼:
string trim(string text)去掉字串text開始和結束處的Null 字元代碼:
string ltrim(string text)去掉字串text開始處的Null 字元代碼:
string rtrim(string text)去掉字串text結束處的Null 字元代碼:
string chop(string text)函數rtrim()的別名

http://www.bkjia.com/PHPjc/486552.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486552.htmlTechArticle字串分割與串連函數: 代碼: array explode(string delimiter, string data) 使用字串 dellimiter 把 data 分割成一個數組返回 類似函數:split() 代碼...

  • 聯繫我們

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