preg_match_all("|http://hi\.baidu\.com\/([^\/]*?)|",$tmp,$blog_id);
解决方案 »
- 调用ob_end_flush()网页仍旧不能显示问题?
- 100分请问发布的新闻怎么改变顺序!!! 表测试字段如下
- 购买凌风的php版本指数算法
- 有关上传文件验证的问题求教
- 求救:关于这段代码中取数据的问题!!
- php 如何得到一个 domain 的 dns 主机的 ip ?
- 一个思考,有兴趣的朋友请讨论
- 用session来进行身份验证(php+mysql环境),我的程序有严重漏洞,help me!
- 如何编译、反编译php代码?
- 微信接收自定义菜单类型pic_photo_or_album问题
- 请教个关于用PHP启动VPN的问题?
- 令我郁闷的事情,现在是上午10,但是date("H")获得的确是02
(
[0] => Array
(
[0] => http://hi.baidu.com/
[1] => http://hi.baidu.com/
[2] => http://hi.baidu.com/
[3] => http://hi.baidu.com/
[4] => http://hi.baidu.com/
[5] => http://hi.baidu.com/
[6] => http://hi.baidu.com/
[7] => http://hi.baidu.com/
[8] => http://hi.baidu.com/
[9] => http://hi.baidu.com/
[10] => http://hi.baidu.com/
[11] => http://hi.baidu.com/
[12] => http://hi.baidu.com/
[13] => http://hi.baidu.com/
..........................
似乎不对吧?菜鸟我不懂正则,一知半解。
(
[0] => Array
(
[0] => http://hi.baidu.com/s
[1] => http://hi.baidu.com/m
[2] => http://hi.baidu.com/m
[3] => http://hi.baidu.com/y
[4] => http://hi.baidu.com/y
[5] => http://hi.baidu.com/4
[6] => http://hi.baidu.com/4
[7] => http://hi.baidu.com/n把第一位给取出来了.请帮我再看下,谢谢。
'/^[' . chr(0xa1) . '-' . chr(0xff) . 'A-Za-z_]$(最少字符数目,最大字符数目)/i
(
[0] => Array
(
[0] => http://hi.baidu.com/s
[1] => http://hi.baidu.com/m
[2] => http://hi.baidu.com/m
[3] => http://hi.baidu.com/y
[4] => http://hi.baidu.com/y
[5] => http://hi.baidu.com/4
[6] => http://hi.baidu.com/4
$tmp = <<< EOT
http://hi.baidu.com/xxxx (xxx为会员帐号,字母数字下划线汉字等不限)http://hi.baidu.com/123 (xxx为会员帐号,字母数字下划线汉字等不限)http://hi.baidu.com/xx_汉字123
http://community.csdn.net/Expert/topic/5229/5229580.xml?temp=.2143824
........
EOT;
preg_match_all("#http://hi\.baidu\.com/((?:[\x80-\xff].|\w)+)#",$tmp,$blog_id);
print_r($blog_id);
?> Array
(
[0] => Array
(
[0] => http://hi.baidu.com/xxxx
[1] => http://hi.baidu.com/123
[2] => http://hi.baidu.com/xx_汉字123
) [1] => Array
(
[0] => xxxx
[1] => 123
[2] => xx_汉字123
))
$url = 'http://hi.baidu.com';
$tmp = file_get_contents($url);
preg_match_all("/\"http:\/\/hi\.baidu\.com\/([^\/]+?)\"/is",$tmp,$blog_id);
print_r($blog_id);
exit;
?>
<?php
$url = 'http://hi.baidu.com';
$tmp = file_get_contents($url);
preg_match_all("/http:\/\/hi\.baidu\.com\/([^\/]+?)[\"|\']/is",$tmp,$blog_id);
print_r($blog_id);
exit;
?>
$url = 'http://hi.baidu.com';
$tmp = file_get_contents($url);
preg_match_all("|http://hi\.baidu\.com\/([^\s\/]*?)|iU",$tmp,$blog_id);
print_r($blog_id);
exit;
?>