久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php怎么去除非漢字

      php去除非漢字的方法:首先創(chuàng)建一個(gè)PHP示例文件;然后用fgets()函數(shù)從txt文件中取出每一行數(shù)據(jù);最后使用正則函數(shù)preg_replace()去除每一行中的非漢字即可。

      php怎么去除非漢字

      本文操作環(huán)境:windows7系統(tǒng)、PHP7.1版,DELL G3電腦

      php怎么去除非漢字?

      php函數(shù)preg_replace() 正則去除非漢字

      項(xiàng)目中需要用到去除非漢字的方法,整理的資料

      $file = fopen("hb/j.txt","r+") or exit("Unable to open file!"); while(!feof($file)){ $line=fgets($file); $pattern = "/[^x{4E00}-x{9FFF}]+/u"; echo preg_replace($pattern, '', $line); echo "<br />"; } fclose($file);

      從txt文件中取出每一行,并去除每一行中的非漢字。

      1.取出一行用fgets()函數(shù)

      2.去除非漢字使用正則函數(shù)preg_replace()

      3.非漢字的正則 /[^x{4E00}-x{9FFF}]+/ ,注意php中,不能用u****表示unicode字符,要用x{****}

      4.u表示修正符

      推薦學(xué)習(xí):《PHP視頻教程》

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