我写了一个类来解析 bbcode,但是当我使用“转义”(函数 chtml::encode 是 htmlspecialchars 的包装器)时出现问题。
MyBBcodeParser:http ://snipt.org/srlo0
案例“BBcodeParser::toHtml($input, false)”:(
Input: [b]hello[/b] <strong>hello2</strong>
Output: <strong>hello</strong> <strong>hello2</strong>
加粗)
案例“BBcodeParser::toHtml($input, true)”:
Input: [b]hello[/b] <strong>hello2</strong>
Output: <strong>hello</strong>&lt;strong&gt;hello2&lt;/strong&gt;
我无法理解第二种情况的双重逃避......