久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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如何實現(xiàn)同義詞替換

      php同義詞替換的實現(xiàn)方法:首先創(chuàng)建一個PHP示例文件;然后定義一個“strtr_words”方法;接著通過“file_get_contents”函數(shù)獲取詞庫;最后通過“explode”等函數(shù)方法實現(xiàn)同義詞替換即可。

      php如何實現(xiàn)同義詞替換

      推薦:《PHP視頻教程》

      php實現(xiàn)SEO偽原創(chuàng)同義詞替換函數(shù)

      近日和一朋友討論PHP關(guān)于同義詞替換的SEO偽原創(chuàng)問題,寫了如下函數(shù),并為emlog做成插件。

      function strtr_words($str) { $words=array(); $content = file_get_contents(‘words.txt’);//詞庫 $content = str_replace( “r”, “”,$content); //去掉換行符(以便兼容Linux主機) $content = preg_split(‘/n/’, $content, -1, PREG_SPLIT_NO_EMPTY);//n分割字符 foreach($content as $k=>$v) { if($k!=0) { $str_data = explode(‘→’,$v);//關(guān)鍵詞分割符 $words+=array(“$str_data[0]“=>”$str_data[1]“); } } return strtr($str,$words);//返回結(jié)果 }

      詞庫words.txt格式如下:

      懇求→哀求 悲悼→哀傷 悲痛→哀思 悲傷→哀痛 順序→挨次 受餓→挨餓 靠攏→挨近

      注意,每一行一組同義詞,中間用“→”分割。

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