求一个匹配URL参数正则表达式
例如
http://www.sina.com.cn/sports/?p=3456
http://www.sina.com.cn/sports/?p=38923
http://www.sina.com.cn/sports/basktball/?p=878923
现在需要匹配出?p=里面的参数,就是加黑的部分
我使用的方法是,
^/?([a-z/]+)/\?p=([0-9]+)
能匹配前面的参数,但是没有办法匹配"?=p"后面的数字参数,请问这段正则表达怎么写呢? 谢谢!
------解决方案--------------------preg_match('/p=(\d+)/',$s,$m);
echo $m[1];
------解决方案--------------------2loou good
------解决方案--------------------preg_match('/(?
echo $match[0];
------解决方案--------------------<br />
(?<=p\=)\d+<br />
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