且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

递归BBCode解析

更新时间:2023-02-22 22:04:10

正如 gordon 在评论中所说的 PHP 有一个 BBCode 解析器,所以没有理由重新发明***.

As gordon said in comments PHP has a BBCode parser, so no reason to reinvent the wheel.

虽然本机解析器是一个 PECL 包,因此您必须安装它.如果这不是一个选项(例如由于共享托管),还有一个 PEAR 包:http://pear.php.net/package/HTML_BBCodeParser

The native parser is a PECL package though, so you will have to install it. If that's not an option (for instance due to shared hosting), there is also a PEAR package: http://pear.php.net/package/HTML_BBCodeParser

除此之外,您还可以查看使用 BB 代码源代码的论坛,并使用他们的解析器或对其进行改进.http://www.bbcode.org/implementations.php 还列出了几个 PHP 实现

In addition to those, you can take a look at forums using BB code source code, and either use their parser, or improve it. There is also several PHP implementations listed at http://www.bbcode.org/implementations.php