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', ...
随机推荐
- hdu1028 Ignatius and the Princess III
这是道典型的母函数的题目,可以看看我的母函数这一标签上的另一道例题,里面对母函数做了较为详细的总结.这题仅贴上代码: #include"iostream" using namesp ...
- html5文章 -- 应用HTML5 开发手机APP
因为HTML5暂时无法短期内在PC普及,主要方向在使用高端浏览器的高端移动设备,所以可以用作开发Android系统的App.但只有Android2.2以上.iOS3.2以上均支持HTML5,两大平台有 ...
- HITOJ 2662 Pieces Assignment(状压DP)
Pieces Assignment My Tags (Edit) Source : zhouguyue Time limit : 1 sec Memory limit : 64 M S ...
- Vertex Fetch Texture (VTF)
http://www.opengl.org/wiki/Vertex_Texture_Fetch Vertex Texture Fetch This article contains inacc ...
- 从 github 执行 git clone 一个大的项目时提示 error: RPC failed
目前克隆一个比较大的项目,出现RPC failed的错误 Cloning into 'bigfiles'... remote: Counting objects: 190, done. remote: ...
- zero cycles - 1 to 30 cycles - tens of millions of cycles
Computer Systems A Programmer's Perspective Second Edition To this point in our study of systems, we ...
- [转]C#之反射
前言 之所以要写这篇关于C#反射的随笔,起因有两个: 第一个是自己开发的网站需要用到 其次就是没看到这方面比较好的文章. 所以下定决心自己写一篇,废话不多说开始进入正题. 前期准备 在VS20 ...
- 在HCI层ACL Connection的建立
一.概述 上一篇博文介绍的是inquiry的整个过程中HCI层的command和event.在寻找到有效的远端蓝牙设备后,开始建立ACL连接,这里仅仅反应HCI层的数据包,对于LM层和Base ...
- NSURLSession
参考文章1, apple文档 一.NSURLSessionConfiguration 介绍:分别配置每一个 session 对象.(NSURLConnection 很难做到) 分类: 1) defau ...
- https centos6 and 7
keytool -printcert -sslserver 10.10.192.90:8443 -rfc >nexus.crt 通过 openssl 将 证书转换为 .pem格式的 通过以下命 ...