久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何清除bom

      php清除bom的方法:1、使用trim函數(shù)去除,代碼為【$result = trim($result, "xEFxBBxBF")】;2、使用iconv函數(shù)去除,代碼為【$result = @iconv("UTF-8", “”】。

      php如何清除bom

      php清除bom的方法:

      BOM頭是UTF-8來告訴編輯器:我是UTF8編碼。它的編碼是xEFxBBxBF

      但是PHP在設計之初并沒有考慮到BOM頭的問題,所以在編解碼的時候很容易出現(xiàn)問題

      比如今天遇到的問題,json_decode,當解碼的string有BOM頭的時候json_decode就解析失敗,返回NULL。

      試了兩種方式能去除掉:

      $result = trim($result, "xEFxBBxBF"); print_r(json_decode($result, true)); exit;

      還有一種:

      $result = @iconv("UTF-8", "GBK//IGNORE", $result); $result = @iconv("GBK", "UTF-8//IGNORE", $result);   print_r(json_decode($result, true)); exit;

      相關(guān)學習推薦:php圖文教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號