http://www.qcbf.tk/php/tool/001/img/img.jpg?name=%20Qcbf&fighting=%201983%20&gl=5%20&kd=0%20&fighting1=1177%20&fighting2624%20%20&fighting3=182%20&ranking=0%20&victory=91%20&victoryS=47.64这种地址,怎么匹配为:http://www.qcbf.tk/php/tool/001/img/%20Qcbf/%201983%20&gl/00/img.jpg这种样子的,把后面的参数匹配到前面当作路径这是httpd.ini[ISAPI_Rewrite]
CacheClockRate 3600
RepeatLimit 32RewriteRule (.*).html$ $1.aspx
RewriteRule (.*)img.jpg$ $1img.php
谢谢了....

解决方案 »

  1.   

    echo preg_replace('/[\?|&][A-Za-z]+=/', '/', 'http://www.qcbf.tk/php/tool/001/img/img.jpg?name=%20Qcbf&fighting=%201983%20&gl=5%20&kd=0%20&fighting1=1177%20&fighting2624%20%20&fighting3=182%20&ranking=0%20&victory=91%20&victoryS=47.64');
      

  2.   

    你中间的fighting2 少等于号echo preg_replace('/[\?|&][A-Za-z0-9]+=/', '/', 'http://www.qcbf.tk/php/tool/001/img/img.jpg?name=%20Qcbf&fighting=%201983%20&gl=5%20&kd=0%20&fighting1=1177%20&fighting2624%20%20&fighting3=182%20&ranking=0%20&victory=91%20&victoryS=47.64');
    /*
    结果
    http://www.qcbf.tk/php/tool/001/img/img.jpg/%20Qcbf/%201983%20/5%20/0%20/1177%20&fighting2624%20%20/182%20/0%20/91%20/47.64
    */
      

  3.   

    晕,原来还要放前面preg_match('/((?!\/).)+/', $str, $match); //提取文件部分
    $str = rtrim($str, $match[0]) //提取路径部分
    $file = explode($match[0], '?') //分离文件名和参数
    $file[1] = $preg_replace('[\?|&][A-Za-z0-9]+=', '/', $file[1]) //把参数处理成斜杠
    $rz = $str . $file[1] . $file[0] // 结果
      

  4.   

    谢谢大家,大家可能理解错了我的意思,
    我是想写在httpd.ini里面的,就是那种伪静态那种的.
      

  5.   


    谢谢大家,大家可能理解错了我的意思,
    我是想写在httpd.ini里面的,就是那种伪静态那种的.