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', ...
随机推荐
- PHP $_SERVER 详解
元素/代码 描述 $_SERVER['PHP_SELF'] 当前执行脚本的文件名,与 document root 有关. $_SERVER['GATEWAY_INTERFACE'] 服务器使用的 CG ...
- PHP 设计模式 笔记与总结(7)适配器模式
① 适配器模式可以将截然不同的函数接口封装成统一的 API ② 实际应用举例:PHP 的数据库操作有 mysql,mysqli,pdo 三种,可以用适配器模式统一成一致.类似的场景还有 cache 适 ...
- Android 通过网页打开自己的APP(scheme)
Android 通过网页打开自己的APP(scheme) 分类: android2014-07-09 17:35 8565人阅读 评论(2) 收藏 举报 通过用手机的浏览器(内置,第三方都可)访问一个 ...
- ip sevices
http://www.ip138.com/ip2city.asp http://www.bliao.com/ip.phtml http://www.whereismyip.com/ http://ww ...
- Behavior-Based Intelligence
Computer Science An Overview _J. Glenn Brookshear _11th Edition Early work in artificial intelligenc ...
- Spark 2.0
Apache Spark 2.0: Faster, Easier, and Smarter http://blog.madhukaraphatak.com/categories/spark-two/ ...
- Machine Learning in Action -- Support Vector Machines
虽然SVM本身算法理论,水比较深,很难懂 但是基本原理却非常直观易懂,就是找到与训练集中支持向量有最大间隔的超平面 形式化的描述: 其中需要满足m个约束条件,m为数据集大小,即数据集中的每个数据点fu ...
- Delphi 如何清除动态数组的内存?
SetLength(glb_IndexConfig,); FreeAndNil(glb_IndexConfig);
- JBPM3.2 TABLE
http://m.blog.csdn.net/blog/longjie_happy/9343349
- 面向对象与面向过程 $this的注意事项和魔术方法set和get
一.面向对象与面向过程的区别: 二者都是一种思想,面向对象是相对于面向过程而言的.面向过程,强调的是功能行为.面向对象,将功能封装进对象,强调具备了功能的对象.面向对象更加强调运用人类在日常的思维逻辑 ...