Home > Backend Development > PHP Tutorial > get参数型字符串取值

get参数型字符串取值

WBOY
Release: 2016-06-23 14:14:00
Original
1181 people have browsed it

类似与get参数的字符串形式如下
result=r1&result1=r2&result2=r3

如何取出result result1 result2的值


回复讨论(解决方案)

用 parse_str 函数

用 parse_str 函数
多谢版主。

function getQueryString(name)
 {    
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");    
var r = window.location.search.substr(1).match(reg);    
if (r != null) 
return unescape(r[2]); 
return null;  
 }
测试:alert(GetQueryString("参数名1"));

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template