Home >Backend Development >PHP Tutorial > 请教怎么修改url某一参数的参数值呢?是要拆开了再拼回去吗

请教怎么修改url某一参数的参数值呢?是要拆开了再拼回去吗

WBOY
WBOYOriginal
2016-06-13 13:30:071073browse

请问如何修改url某一参数的参数值呢?是要拆开了再拼回去吗?
那么请问如何修改url某一参数的参数值呢?是要拆开了再拼回去吗?
http://127.0.0.1/myo/newuser.php?mod=search&type=fastone
比如现在我要修改mod=new
要怎么做呢?

------解决方案--------------------
发送了请求就改不鸟了,
只有这样。
$mod = $_GET['mod'];
if( $mod == 'search' ){
$mod = 'new';
}

如果是字符串 可以

HTML code



    
        <meta charset="gb2312">
        <title></title>
    
    
        <script>
            var str = 'http://127.0.0.1/myo/newuser.php?mod=search&type=fastone';
            var re = /(mod=)(.+?)(?=&)/i;
            str = str.replace(re, '$1new');
            alert(str)
        </script>
    

<br><font color="#e78608">------瑙e</font>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn