彩色显示和格式化PHP代码
花了一个晚上写了一个可以彩色显示和格式化PHP代码的PHP程序,大部分功能已经实现,
还有一些小BUG,有兴趣的朋友一起来看看。我是字符一个一个分析的,所以很麻烦,不知道
有没有什么好的实现方法?
这里是演示地址:http://www.imsorry.com.cn/php/convert.php
调用的源码是:
<?php
include 'colortext.class.php';
header("Content-Type:text/html;charset=GB2312");
$cf = new CColorText();
$cf->SetFileName('colortext.class.php'); // 设置文件名
$cf->SetFormat(true); // 格式化代码
?>
<html>
<head>
<style type="text/css">
body {font-size: 9pt;}
</style>
</head>
<body>
<?
// 输出内容
echo $cf->Format();
?>
</body>
</html>