久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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 正則表達(dá)式驗(yàn)證中文的問(wèn)題

      $str = ‘中華人民共和國(guó)123456789abcdefg’;
      echo preg_match(“/^[u4e00-u9fa5_a-zA-Z0-9]{3,15}$”,$strName);

      運(yùn)行一下上面這段代碼,看會(huì)有什么提示信息?
      Warning: preg_match(): Compilation failed: PCRE does not support L, l, N, P, p, U, u, or X at offset 3 in F:wwwrootphptest.php on line 2

      原來(lái),PHP正則表達(dá)式中不支持下列 Perl 轉(zhuǎn)義序列:L, l, N, P, p, U, u, or X

      在 UTF-8 模式下,允許用“x{…}”,花括號(hào)中的內(nèi)容是表示十六進(jìn)制數(shù)字的字符串。原來(lái)的十六進(jìn)制轉(zhuǎn)義序列 xhh 如果其值大于 127 的話則匹配了一個(gè)雙字節(jié) UTF-8 字符。
      所以,可以這樣來(lái)解決preg_match(“/^[x80-xff_a-zA-Z0-9]{3,15}$”,$strName);

      復(fù)制代碼 代碼如下:
      <?php
      $shouji =”哈哈哈哈”;
      if (!preg_match(“/^[x80-xff]{6,30}$/”,$shouji)){
          echo “nonono”;    
      }
      else {
          echo “yesyesyes”;
      }
      ?>
      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)