<p>function highlighter_text($text, $words){</p><p> $split_words = explode( " " , $words );</p><p> foreach($split_words as $word) {</p><p> $color = "#4285F4";</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/7fc7563c4182" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">PHP免费学习笔记(深入)</a>”;</p><p> $text = preg_replace("|($word)|Ui" , "<b>$1</b>" , $text );</p><p> }</p>
<div class="aritcle_card">
<a class="aritcle_card_img" href="/ai/1385">
<img src="https://img.php.cn/upload/ai_manual/000/000/000/175680265595886.png" alt="纳米搜索">
</a>
<div class="aritcle_card_info">
<a href="/ai/1385">纳米搜索</a>
<p>纳米搜索:360推出的新一代AI搜索引擎</p>
<div class="">
<img src="/static/images/card_xiazai.png" alt="纳米搜索">
<span>30</span>
</div>
</div>
<a href="/ai/1385" class="aritcle_card_btn">
<span>查看详情</span>
<img src="/static/images/cardxiayige-3.png" alt="纳米搜索">
</a>
</div>
<p> return $text;</p><p>}</p><p>$string = "I like chocolates and I like apples";$words = "apple";</p><p>echo highlighter_text($string ,$words);</p>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号