Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在我的网站上显示用户输入的 PHP 代码。我的问题是这段代码的样式,是否有一个项目可以为我解析 PHP 代码(并设置它的样式),还是我必须自己创建一个 PHP 解析器/样式器?(我在网上搜索过,但找不到我要找的东西)
我的网站是用 PHP 编写的,带有 Yii 框架。
提前致谢。
使用highlight_string()功能
highlight_string()
看看highlight-string()方法。
对于解析 PHP,您可以使用Tokenizer。
如果您需要代码解析器,请检查此分机:
http://www.yiiframework.com/extension/yiidecoda/
我是帮助