Discuz! X 开启HTML后script代码不解析

Discuz! X 开启HTML在编辑器里面插入HTML代码,script代码不能运行

修改source\fundtion\function_discuzcode.php

找到

if(!$htmlon) {
                $message = dhtmlspecialchars($message);
        } else {
                $message = preg_replace("/<script[^\>]*?>(.*?)<\/script>/i", '', $message);
        }

把后面的

else {
                $message = preg_replace("/<script[^\>]*?>(.*?)<\/script>/i", '', $message);
        }

注释或删掉

来源:https://shipengliang.com/software-exp/discuz-x2-5-x3-%E5%BC%80%E5%90%AFhtml%E5%90%8Escript%E4%BB%A3%E7%A0%81%E4%B8%8D%E8%A7%A3%E6%9E%90%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95.html