http://localhost/show.php?t=1&b=Dell&m=75UYF
改写为
http://localhost/show.php/t/1/b/Dell/m/75UYF.htm多个参数,又该如何呢?

解决方案 »

  1.   

    $str = 'http://localhost/show.php?t=1&b=Dell&m=75UYF';
    $str = preg_replace('#(?:[\?|\&])(.+?)\=([^\&]+?)#is','/$1/$2',$str) . ".htm";
    echo $str;
      

  2.   

    也可以这样:
    先parse_url然后……
      

  3.   

    echo preg_replace("/[?&#=]/", "/", $str) . "htm";
      

  4.   

    echo preg_replace("/[?&#=]/", "/", $str) . "htm";
    ---------------------.....It can be so easy.....so stupid I am !
      

  5.   

    RewriteEngine   on
    RewriteBase     /
    RewriteRule     (.+)\.html$ show.php?id=$1 [L]