亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長(zhǎng)資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

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

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

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

    推薦:《PHP視頻教程》

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

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

    function strtr_words($str) { $words=array(); $content = file_get_contents(‘words.txt’);//詞庫(kù) $content = str_replace( “r”, “”,$content); //去掉換行符(以便兼容Linux主機(jī)) $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é)果 }

    詞庫(kù)words.txt格式如下:

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

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

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