纯文本的格式显示

我要将程序源代码显示出来。
不知缩进的格式有什么好的处理方法。

1<pre>不好用。   
2因为我的源码中要插入其他链接。   
3\---------------------------------------------------------------   
4  
5用html的 替换空格   
6\---------------------------------------------------------------   
7  
8只有做替换了,而且不很好换   
9例:   

$s = "asd<a href="xxxx.xxx">dsgsdf</a><br/> gsksdgsdlkgjlksgjfg";
$space = "&amp;"."nbsp;";
$s = str_replace(" ",$space,$s);
while(($s1 = eregi_replace("(&lt;[^&lt;])".$space."([^&lt;]&gt;)","\\1 \\2",$s))!=$s)
$s = $s1;
$s = $s1;
echo $s;

Published At
Categories with Web编程
comments powered by Disqus