preg_match_all
<meta charset="utf8">
<?php
set_time_limit (0);
for($i=1;$i<34;$i++){
$url = "http://www.cnblogs.com/hellowzd/default.html?page=".$i;
$str=file_get_contents($url);
preg_match_all('|阅读\((.*?)\) 评论|i',$str,$m);
$data[] = $m['1']; preg_match_all('|class="postTitle2"(.*?)</a>|i',$str,$m1);
$data1[]=$m1['1']; $i=0;
foreach ($data as $k=>$v){
$i++;
$content[$i]['count'] = $v;
} $i=0;
foreach ($data1 as $k=>$v){
$i++;
$content[$i]['content'] = $v;
} echo "<pre>";
print_r ($content);
echo "</pre>"; /* foreach ($content as $key=>$value){
if($value['count'] >100){
echo $value['content']."------------".$value['count']."<br>";
}
} */ } ?>
preg_match_all的更多相关文章
- php_match/preg_match_all 默认有字符串长度限制
php_match/preg_match_all 默认有字符串长度限制:52500(或许你的服务器环境是更长,或者更短),当字符串长度大于52500,只能匹配到52500数据,超出的部分会被系统自己截 ...
- php 函数preg_match、preg_match_all ,以及正则表达式规则
<?php $str = 'php is the best language phhhhp is'; $part = '/ph{1,}p/'; echo preg_match($part, $s ...
- preg_match_all正则表达式的基本使用
了解正则表达式之前,须要掌握一些常用的正则表达式的基础知识,这些如果能记得最好记得,记不住须要用的时候能查到就行,就多个特殊字符,所以说正则表达式玩的就是特殊,具体大家可以查看更加细致的说明. pre ...
- php preg_match_all 和 str_replace 替换图片链接
需求:在 a 网站的后台添加一片文章,需要同步到 b 网站(两个网站数据库在同一台服务器). 思路是添加文章时,除了往 b 网站的数据库中添加数据外,再往 a 网站的数据库中添加数据. a 添加文章的 ...
- preg_match_all, preg_match
int preg_match(string $pattern, string $subject[, $arr][, int $flags]);$pattern 正则表达式$subject: 要搜索的字 ...
- PHP 正则表达式匹配 preg_match 与 preg_match_all 函数
--http://www.5idev.com/p-php_preg_match.shtml 正则表达式在 PHP 中的应用 在 PHP 应用中,正则表达式主要用于: 正则匹配:根据正则表达式匹配相应的 ...
- php preg_match 和preg_match_all
$h3=trim('[我要变强][主流程]整体功能测试点');$matches=array();preg_match_all('/[(.+?)]/', $h3,$matches); print_r($ ...
- javascript 正则匹配 提取所有 preg_match_all matchAll方法
javascript 提取全部的的方法.javascript中没有matchAll这种方法. 用while来实现类似 PHP 中的preg_match_all() :(by default7#zbph ...
- 学习PHP函数:preg_match_all
<?php $str = '10.10.10.10, 10.10.10.11'; preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', ...
随机推荐
- Scrum会议2
小组名称:天天向上 项目名称:连连看 参会成员:王森(Master)张金生 张政 栾骄阳 时间:2016.10.17 已完成内容: 1.连连游戏的图片素材选取. 2.连连看具体的功能种类. 计划完成: ...
- JavaScript系列:再巩固-原型链
图 1.实例:'对象(实例)'有属性__proto__,指向该对象(实例)的'构造函数的原型对象'. 2.方法:'构造函数'除了有属性__proto__,所有构造函数方法的__proto__指向Fun ...
- Maven 创建多模块工程
1. 创建父项目 new -->project-->maven-->maven Project,然后下一步, 进入new maven Project的Select project n ...
- PHP里用户密码的回复和管理
1). In /etc/my.ini, add skip-grant-tables 2). mysql -u root -p (no password required) mys ...
- laravel url() 和 asset() 的区别
asset()方法用于引入 CSS/JavaScript/images 等文件,文件必须存放在public文件目录下.url()方法生成一个完整的网址.
- IS_POST:判断是否存在POST提交
IS_POST:判断是否存在POST提交 在程序中可以使用IS_POST来做优化..如果有提交.我们再执行下一步动作.节省开销
- Moving in Unity
转自:http://angryant.com/2014/03/07/Moving-in-Unity/ ,详细描述了物体在unity中移动的几种方式,并且给出了代码描述,对加深对Unity理解很有帮助, ...
- MemcacheQ安装及使用
一.MemcacheQ安装记录1.安装libevent查看是否已经安装了libeventrpm -qa|grep libevent如果没有安装使用yum安装yum install libevent l ...
- Windows注册表(持续更新)
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Zoom 下, 设置DWORD 值 ZoomDisabled 等于 1.
- XMLHttpRequest函数
function createXmlHttpRequest(){ if(window.ActiveXObject){ return new ActiveXObject("Microsoft. ...