RewriteRule     (.+)/(.+)\.php$ $1/b.php?brand=$2
这这样得到的参数怎么是
$_GET["brand"]=b;
哪写错了?

解决方案 »

  1.   

    RewriteRule (.+)/(.+)\.php$ $1/b.php?brand=$2
    这样http://localhost/file/aaa.php
    得到的参数怎么是,应该是aaa才对呀
    $_GET["brand"]=b;
    哪写错了?
      

  2.   

    (.+?)/(.+?)\.php$ $1/b.php?brand=$2不要使用贪婪匹配。
      

  3.   

    RewriteRule     (.+)/b/(.+)\.php$ $1/b.php?brand=$2
    http://localhost/laptop-batteries/b/ACER.php
    这样可以,传递的参数值为$_GET["brand"]=ACERRewriteRule     (.+)/(.+)\.php$ $1/b.php?brand=$2
    http://localhost/laptop-batteries/ACER.php
    这样不行,传递的参数值为$_GET["brand"]=b
      

  4.   

    谢谢aotianlong的热心解答
    RewriteRule     (.+?)/(.+?)\.php$ $1/test1.php?brand=$2
    http://localhost/laptop-batteries/ACER.php
    传递的参数值为$_GET["brand"]=test1RewriteRule     (.+?)/(.+?)\.php$ $1/test2.php?brand=$2
    http://localhost/laptop-batteries/ACER.php
    传递的参数值为$_GET["brand"]=test2
    每次都只把文件名传递过来