Home >Backend Development >PHP Tutorial >哪位高手帮小弟我匹配下URL

哪位高手帮小弟我匹配下URL

WBOY
WBOYOriginal
2016-06-13 10:15:511062browse

谁帮我匹配下URL
Mar 8 12:51:26 10.10.255.5 haproxy[4843]: 124.240.42.88:54351[10.10.255.5:36672]->121.14.0.101:80[121.14.0.101:80] [08/Mar/2012:12:51:26.627] http_check http_image/ 6/0/9/10/26 200 1520 - - ---- 500
/500/9/0/0 0/0 {news.sohu.com|http://wei.sohu.com/s2011/wei/?20120308} "GET /upload/sogou_world_20100618/h_bg_tag74on.gif HTTP/1.1"

------解决方案--------------------
$log = '
Mar 8 12:51:26 10.10.255.5 haproxy[4843]: 124.240.42.88:54351[10.10.255.5:36672]->121.14.0.101:80[121.14.0.101:80] [08/Mar/2012:12:51:26.627] http_check http_image/ 6/0/9/10/26 200 1520 - - ---- 500
/500/9/0/0 0/0 {news.sohu.com|http://wei.sohu.com/s2011/wei/?20120308} "GET /upload/sogou_world_20100618/h_bg_tag74on.gif HTTP/1.1"
';

preg_match('/http:\/\/(.*?)\s*}/s', $log, $m);
print_r($m[1]);

------解决方案--------------------
"#://([^/]+)#"

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