preg_match_all("/<(.*)>/iUs",$html,$matches);
foreach ($matches[0] as $key => $value)
{
    $html=str_replace($value,strtolower($value),$html);
}

解决方案 »

  1.   

    好没道理!<?php
    function foo($t) {
      return strtoupper($t);
      return "<$t$s/$t>";
    }
    $text = <<< TEXT
    <a href=xxx>ppp</a>
    <img src=xxx>
    <font color=red>ppp</font>
    TEXT;
    echo preg_replace("/(<\w+)|(\/\w+>)/ie","foo('\\0')",$text);
    ?>
      

  2.   

    我那个是行的,以下代码ZEND DEBUG通过<?php
    ob_start();
    ?>
    <html XMLNS="http://www.w3.org/1999/xhtml" lang="UTF-8">
    <head>
    <TITLE>Mybile Myself</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <META http-equiv="Content-Language" content="UTF-8" />
    </HEAD>
    <BOdy>
    <?phpecho "654565fdss反对撒";
    ?>
    </BODY>
    </html>
    <?php
    $html=ob_get_contents();
    preg_match_all("/<(.*)>/iUs",$html,$matches);
    foreach ($matches[0] as $key => $value)
    {
    $html=str_replace($value,strtolower($value),$html);
    }
    ob_end_clean();
    echo $html;
    ?>
      

  3.   

    恩,看错了...我以为你是要大写变为小写....改了一下
    测试代码:
    <?php
    ob_start();
    ?>
    <html XMLNS="http://www.w3.org/1999/xhtml" lang="UTF-8">
    <head>
    <TITLE>Mybile Myself</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <META http-equiv="Content-Language" content="UTF-8" />
    </HEAD>
    <BOdy>
    <?phpecho "654565fdss反对撒";
    ?>
    </BODY>
    </html>
    <?php
    $html=ob_get_contents();
    preg_match_all("/<(.*)>/iUs",$html,$matches);
    foreach ($matches[0] as $key => $value)
    {
    $html=str_replace($value,strtoupper($value),$html);
    }
    ob_end_clean();
    echo $html;
    ?>关键代码:
    preg_match_all("/<(.*)>/iUs",$html,$matches);
    foreach ($matches[0] as $key => $value)
    {
    $html=str_replace($value,strtoupper($value),$html);
    }
      

  4.   

    我又改了一下....应该没什么问题了..<?php
    ob_start();
    ?>
    <html XMLNS="http://www.w3.org/1999/xhtml" lang="UTF-8">
    <head>
    <TITLE>Mybile Myself</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <META http-equiv="Content-Language" content="UTF-8" />
    </HEAD>
    <BOdy>
    <?phpecho "654565fdss反对撒";
    ?>
    <a href="sss"></a>
    </BODY>
    </html>
    <?php
    $html=ob_get_contents();
    preg_match_all("/<([A-Z]*)( |>)|<\/([A-Z]*)>/iU",$html,$matches);
    foreach ($matches[0] as $key => $value)
    {
    $html=str_replace($value,strtoupper($value),$html);
    }
    ob_end_clean();
    echo $html;
    ?>
    关键代码preg_match_all("/<([A-Z]*)( |>)|<\/([A-Z]*)>/iU",$html,$matches);
    foreach ($matches[0] as $key => $value)
    {
    $html=str_replace($value,strtoupper($value),$html);
    }