Home > Backend Development > PHP Tutorial > 正则处理获取到 对应的值

正则处理获取到 对应的值

WBOY
Release: 2016-06-20 12:40:39
Original
1091 people have browsed it


$str="username=tttttt&pwd=123123"

通过正则获取到  tttttt  和 123456 这两个值  谢谢   username 和 pwd 都是固定的


回复讨论(解决方案)

用这个函数更好

$str="username=tttttt&pwd=123123";parse_str($str,$arr);print_r($arr);/*Array(    [username] => tttttt    [pwd] => 123123)*/
Copy after login

parse_str($str, $output);
print_r($output);

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