如何用PHP将"<a class=blue_2
href=www.baidu.com>"
输出?

解决方案 »

  1.   

    echo "<a class=blue_2
    href=www.baidu.com>";就好了直接看不出来,你查看网页源码,就知道,已经输出了
      

  2.   

    echo ""<a class=blue_2 href=www.baidu.com>";
      

  3.   

    楼主是想问如何用php在页面输出html代码吧?
    复制这些代码直接执行就可以看到你想要的效果了。
    其实答案很简单,使用htmlentities()函数将html代码转义就可以直接输出显示了。
    第一种:
    <?php
    $str = "<a class=blue_2
    href=www.baidu.com>";
    echo(htmlentities($str));
    ?>
    第二种:保持你问题中换行格式的
    <?php
    $str = "<a class=blue_2";
    $str2 = "href=www.baidu.com>";
    echo(htmlentities($str).'<br>');
    echo(htmlentities($str2));
    ?>