汪凤秀 發表於 2023-7-9 00:00:00

PHPCMS v9过滤采集内容中CSS样式的实现方法

<p>
方法如下:</p>
<p>
  1、找到\phpcms\libs\functions\global.func.php 打开,然后添加函数</p>
<p>
 </p>
<div>

<p>
代码如下:</p>
</div>
<div id="phpcode2">
<br>
function htmrp($str) {<br>
$str = preg_replace("/&lt;script[^&gt;]*&gt;/i", "", $str); <br>
$str = preg_replace("/&lt;\/script&gt;/i", "", $str);<br>
$str = preg_replace("/&lt;iframe[^&gt;]*&gt;/i", "", $str); <br>
$str = preg_replace("/&lt;\/iframe&gt;/i", "", $str); <br>
$str = preg_replace("/&lt;style[^&gt;]*&gt;/i", "", $str); <br>
$str = preg_replace("/&lt;\/style&gt;/i", "", $str); <br>
$str = preg_replace("/&lt;div[^&gt;]*&gt;/i", "", $str); <br>
$str = preg_replace("/&lt;\/div&gt;/i", "", $str);<br>
return $str;<br>
}</div>
<p>
 </p>
<p>
2、修改当前模板中文章内容页模板show.html</p>
<p>
  界面—模板风格—详情列表—content—show.html</p>
<p>
  找到</p>
<p>
{if $allow_visitor==1}<br>
     {$content}<br><br>
  修改为<br>
 </p>
<div>

<p>
代码如下:</p>
</div>
<div id="phpcode3">
<br>
{if $allow_visitor==1}<br>
{htmrp($content)}</div>
<p>
 </p>
<p>
  3、更新缓存,刷新即可。</p>
頁: [1]
查看完整版本: PHPCMS v9过滤采集内容中CSS样式的实现方法