久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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)站

      eregi_replace與preg_replace 函數(shù)代碼的用法比較

      eregi_replace ( string pattern, string replacement, string string )
      preg_replace ( mixed pattern, mixed replacement, mixed subject [, int limit [, int &count]] )
      以上兩個(gè)函數(shù)基本義定義我知道
      但是里面樣式或參數(shù)的定義我搞不懂
      例如以下是UBB與YBB Code的用法
      $str = eregi_replace(“\[url]http://([^\[]*)\[/url\]”,”<a href=”http://\1″ target=”_blank”>\1</a>”,$str);
      $text = preg_replace(“!([url=)(http|https|ftp)(://S+?)(])(.+?)([/url])!i”, “<a href=’\2\3′ target=’_blank’>\5</a>”, $text);
      有誰(shuí)能說(shuō)明解決里面那些符號(hào)代表何意義?
      我相信很多人也只會(huì)照抄來(lái)用
      但是搞不懂意思,搞不懂意思的話,就不可能自己寫(xiě)程式,
      發(fā)揮這函數(shù)的功能了
      preg_replace() 函數(shù)使用了 Perl 兼容正則表達(dá)式語(yǔ)法,通常是比 ereg_replace() 更快的替代方案。
      形式或(自 PHP 4.0.4 起)$n 形式的逆向引用,首選使用后者。每個(gè)此種引用將被替換為與第 n 個(gè)被捕獲的括號(hào)內(nèi)的子模式所匹配的文本
      n 可以從 0 到 99,其中 \0 或 $0 指的是被整個(gè)模式所匹配的文本。對(duì)左圓括號(hào)從左到右計(jì)數(shù)(從 1 開(kāi)始)以取得子模式的數(shù)目
      例子 1. 逆向引用后面緊接著數(shù)字的用法

      復(fù)制代碼 代碼如下:
      <?php 
      $string = “April 15, 2003”; 
      $pattern = “/(w+) (d+), (d+)/i”; 
      $replacement = “${1}1,$3”; 
      print preg_replace($pattern, $replacement, $string); 
      /* Output 
      ====== 
      preg_replace() 搞不清楚是想要一個(gè) \1 的逆向引用后面跟著一個(gè)數(shù)字 1 還是一個(gè) \11 的逆向引用。本例中的解決方法是使用 ${1}1 
      April1,2003 
      */ 
      ?> 
      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)