<?
$color="#ff0000";
echo "<font color=".$color.">不会是想这样吧</font>";
echo"<font color=#ff0000>不会是想这样吧</font>";
?>

解决方案 »

  1.   

    2楼正解
    建议用CSS,便于维护!
      

  2.   

    我不想显示字符串时有颜色,只想字符串有颜色
    ???????$str = "asdasd颜色asdasd";好了!字符串有“颜色”了。
      

  3.   

    【quote】<?
    $color="#ff0000";
    echo "<font color=".$color.">不会是想这样吧</font>";
    echo"<font color=#ff0000>不会是想这样吧</font>";
    ?>【/quote】
    我一般也是这么做的,楼主的逻辑混乱。何为"我不想显示字符串时有颜色,只想字符串有颜色"?
      

  4.   

    mixed highlight_string ( string str [, bool return] )
    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. 
      

  5.   

    CSS,用CSS更简捷,更方便,也有利于日后修改...
      

  6.   

    我不想显示字符串时有颜色,只想字符串有颜色???难道你说的是用editplus的时候字符串用引号一引变粉红色???
      

  7.   

    当然,如果你自己写一个编写php的软件,那就不同了
      

  8.   

    估计是想:PHP的关键字都要高亮度显示吧??
    再不说清楚,以后不要搭理这些自娱自乐的人了~