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

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

DDD
DDDOriginal
2016-06-13 10:24:451016browse

请问如何修改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
<!DOCTYPE HTML><html>    <head>        <meta charset="gb2312" />        <title></title>    </head>    <body>        <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>    </body></html>

简单点,可以这么写:
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