Home  >  Article  >  Backend Development  >  求一个正规表达式

求一个正规表达式

WBOY
WBOYOriginal
2016-06-20 12:28:37768browse

sss=a&token=asfasdfd我想用正规得到token= 后面的内容 因为token后面没有了东西了 我一时不知道怎么写了token=(.*)  后面写一个什么呢?


回复讨论(解决方案)

token=(.*)  
你这样也能获取啊
改成这样好点
token=(.*?)

用parse_str岂不是更好?

$s = 'sss=a&token=asfasdfd';parse_str($s, $arr);print_r($arr);

Array
(
    [sss] => a
    [token] => asfasdfd
)

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
Previous article:PHP是世界上最好的语言吗?Next article:开发拾遗