<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的更多相关文章

  1. php_match/preg_match_all 默认有字符串长度限制

    php_match/preg_match_all 默认有字符串长度限制:52500(或许你的服务器环境是更长,或者更短),当字符串长度大于52500,只能匹配到52500数据,超出的部分会被系统自己截 ...

  2. php 函数preg_match、preg_match_all ,以及正则表达式规则

    <?php $str = 'php is the best language phhhhp is'; $part = '/ph{1,}p/'; echo preg_match($part, $s ...

  3. preg_match_all正则表达式的基本使用

    了解正则表达式之前,须要掌握一些常用的正则表达式的基础知识,这些如果能记得最好记得,记不住须要用的时候能查到就行,就多个特殊字符,所以说正则表达式玩的就是特殊,具体大家可以查看更加细致的说明. pre ...

  4. php preg_match_all 和 str_replace 替换图片链接

    需求:在 a 网站的后台添加一片文章,需要同步到 b 网站(两个网站数据库在同一台服务器). 思路是添加文章时,除了往 b 网站的数据库中添加数据外,再往 a 网站的数据库中添加数据. a 添加文章的 ...

  5. preg_match_all, preg_match

    int preg_match(string $pattern, string $subject[, $arr][, int $flags]);$pattern 正则表达式$subject: 要搜索的字 ...

  6. PHP 正则表达式匹配 preg_match 与 preg_match_all 函数

    --http://www.5idev.com/p-php_preg_match.shtml 正则表达式在 PHP 中的应用 在 PHP 应用中,正则表达式主要用于: 正则匹配:根据正则表达式匹配相应的 ...

  7. php preg_match 和preg_match_all

    $h3=trim('[我要变强][主流程]整体功能测试点');$matches=array();preg_match_all('/[(.+?)]/', $h3,$matches); print_r($ ...

  8. javascript 正则匹配 提取所有 preg_match_all matchAll方法

    javascript 提取全部的的方法.javascript中没有matchAll这种方法. 用while来实现类似 PHP 中的preg_match_all() :(by default7#zbph ...

  9. 学习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', ...

随机推荐

  1. 记一本关于thinkphp&&MVC的好书

    看过好多书,写thinkphp就蜻蜓点水般,而且语言比较书面.看到了李开涌写的php mvc开发实战.他本人是技术方面的专家,写的书结合了对技术的理解.我读起来感觉收获颇多.比如model这块,我一直 ...

  2. CKEditor的使用-编辑文本

    官网下载以及演示:http://ckeditor.com/ 引入js <script src="/Example6/ckeditor/ckeditor.js">< ...

  3. 【转】const和static readonly

    我们都知道,const和static readonly的确很像:通过类名而不是对象名进行访问,在程序中只读等等.在多数情况下可以混用.二者本质的区别在于,const的值是在编译期间确定的,因此只能在声 ...

  4. Solr学习笔记之3、Solr dataimport - 从SQLServer导入数据建立索引

    Solr学习笔记之3.Solr导入SQLServer数据建立索引 一.下载MSSQLServer的JDBC驱动 下载:Microsoft JDBC Driver 4.0 for SQL Server ...

  5. C++的ORM 开源框架

    C++的ORM 开源框架 介绍一个C++的ORM工具ODB SOCI.LiteSQL.POCO数据库访问类库对比

  6. A trip through the Graphics Pipeline 2011_04

    Welcome back. Last part was about vertex shaders, with some coverage of GPU shader units in general. ...

  7. Memcached 笔记与总结(3)安装 php-memcache(windows 系统下)

    在 windows 下安装 php-memcache,需要下载编译好的 memcached.dll. 要找到可用的 dll 文件,需要根据 php.ini 中的 3 个参数来选择 dll 文件: ① ...

  8. php中ajax跨域请求---小记

    php中ajax跨域请求---小记   前端时间,遇到的一个问题,情况大约是这样: 原来的写法: 前端js文件中: $.ajax({ type:'get', url:'http://wan.xxx.c ...

  9. MySQL 性能优化的最佳20多条经验分享[转]

    今天,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关于数据库的性能,这并不只是DBA才需要担心的事,而这更是我们程序员需要去关注的事情.     当我们去设计数据库表结构, ...

  10. Nginx模块fastcgi_cache的几个注意点

    fastcgi响应http请求的结果中,响应头包括Expires、Cache-Control、Set-Cookie三个,都会可能不被cache. thinkphp3.0禁止session自动启动 co ...