<?
$color="#ff0000";
echo "<font color=".$color.">不会是想这样吧</font>";
echo"<font color=#ff0000>不会是想这样吧</font>";
?>
$color="#ff0000";
echo "<font color=".$color.">不会是想这样吧</font>";
echo"<font color=#ff0000>不会是想这样吧</font>";
?>
建议用CSS,便于维护!
???????$str = "asdasd颜色asdasd";好了!字符串有“颜色”了。
$color="#ff0000";
echo "<font color=".$color.">不会是想这样吧</font>";
echo"<font color=#ff0000>不会是想这样吧</font>";
?>【/quote】
我一般也是这么做的,楼主的逻辑混乱。何为"我不想显示字符串时有颜色,只想字符串有颜色"?
The highlight_string() function outputs a syntax highlighted version of str using the colors defined in the built-in syntax highlighter for PHP. If the second parameter return is set to TRUE then highlight_string() will return the highlighted code as a string instead of printing it out. If the second parameter is not set to TRUE then highlight_string() will return TRUE on success, FALSE on failure.
再不说清楚,以后不要搭理这些自娱自乐的人了~