阳光梅梅 發表於 2023-6-15 00:00:00

dedecms自动给已经发布过的文章中的关键词加超链接

<p class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        代码如下:</p>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        foreach($kws as $k) <br>
        { <br>
        $k = trim($k); <br>
        if($k!=”") <br>
        { <br>
        if($i &gt; $maxkey) <br>
        { <br>
        break; <br>
        } <br>
        $myrow = $this-&gt;dsql-&gt;GetOne(“select * from dede_keywords where keyword=’$k’ And rpurl&lt;&gt;” “); <br>
        if(is_array($myrow)) <br>
        { <br>
        $karr[] = $k; <br>
        $GLOBALS['replaced'][$k] = 0; <br>
        $kaarr[] = “&lt;a href=’{$myrow['rpurl']}’&gt;&lt;u&gt;$k&lt;/u&gt;&lt;/a&gt;”; <br>
        } <br>
        $i++; <br>
        } <br>
        } </p>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>把它替换成: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <p class="right">
                <span><u>复制代码</u></span></p>
        <p>
                代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        global $dsql; <br>
        $query=”SELECT * FROM dede_keywords WHERE rpurl&lt;&gt;” ORDER BY rank DESC”; <br>
        $dsql-&gt;SetQuery($query); <br>
        $dsql-&gt;Execute(); <br>
        while($row = $dsql-&gt;GetArray()) <br>
        { <br>
        $key = trim($row['keyword']); <br>
        $key_url=trim($row['rpurl']); <br>
        $karr[] = $key; <br>
        $kaarr[] = “&lt;a href=’$key_url’ target=’_blank’&gt;&lt;u&gt;$key&lt;/u&gt;&lt;/a&gt;”; <br>
        } </p>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>友情提示一下:文件的修改请注意备份! </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>在后台,系统设置里设定一下自动替换的次数就行了。</span></p>
頁: [1]
查看完整版本: dedecms自动给已经发布过的文章中的关键词加超链接