phpcms 不支持iframe怎么办?
在网上找过很多的办法试着来解决的在 phpcms的内容编辑器 下标签 iframe和JavaScript 被过滤的问题,结果都不能如愿以偿。
然后再接下来的几天里面。我去把phpcms\libs\functions\global.func.php中的函数函数文件都看了一遍,终于找到了问题所在。
发现149行的 trim_script()这个函数转定义了标签,于是乎注释掉。
function trim_script($str) { if(is_array($str)){ foreach ($str as $key => $val){ $str[$key] = trim_script($val); } }else{ $str = preg_replace ( '/\<([\/]?)script([^\>]*?)\>/si', '<\\script\\2>', $str ); $str = preg_replace ( '/\<([\/]?)iframe([^\>]*?)\>/si', '<\\iframe\\2>', $str ); $str = preg_replace ( '/\<([\/]?)frame([^\>]*?)\>/si', '<\\frame\\2>', $str ); $str = str_replace ( 'javascript:', 'javascript:', $str ); } return $str; }
修改成
function trim_script($str) { if(is_array($str)){ foreach ($str as $key => $val){ $str[$key] = trim_script($val); } }else{ //$str = preg_replace ( '/\<([\/]?)script([^\>]*?)\>/si', '<\\script\\2>', $str ); //$str = preg_replace ( '/\<([\/]?)iframe([^\>]*?)\>/si', '<\\iframe\\2>', $str ); //$str = preg_replace ( '/\<([\/]?)frame([^\>]*?)\>/si', '<\\frame\\2>', $str ); $str = str_replace ( 'javascript:', 'javascript:', $str ); } return $str; }
然后再到内容 编辑器里面去插入 iframe或者JavaScript 看看吧。是不是能成功的插入了呢!
PHP中文网,大量的免费PHPCMS教程,欢迎在线学习!
The above is the detailed content of What should I do if phpcms does not support iframe?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools
