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', ...
随机推荐
- tp框架中表单数据的接收
在thinkphp框架中,接收传过来的表单数据.如果一个一个处理,当数据多时,不显示.也可以用循环.最好的是使用create函数,接受所有的数据.代码行大大减少.很方便.
- Wps 方框里面加勾
1.选择插入-->选择符号 2.选择更多 3.选择 字体Wingdings 然后下拉到最后.就看到了
- 基本Java数据类型
一.整型:java中的基本数据类型byte,占用1个字节,8位 取值范围:0000 0000 ~ 1111 1111 (-128 ~ 127) 为什么不是:0000 0000 ~ 1111 1 ...
- String对象的方法
Function Description Example CompareTo() Compares one string to another ("Hello").CompareT ...
- iOS segue 跳转
场景描述: 要实现在tableViewController 的界面A里,点击一个cell ,跳转到第二个viewController的界面B .在第二个界面里做相应操作. 我的做法,利用sb,在A 里 ...
- FastDFS常见命令
1: 启动FastDFS tracker: ./fdfs_trackered .../tracker.conf storage: ./fdfs_storaged .../storage.conf ...
- HTTP POST, PUT PATCH
POST = 新增 GET = 讀取 PUT = 更新 DELETE = 刪除 PUT 会在地址栏显示参数信息,不安全! 理解POST和PUT的区别,顺便提下RESTfu 这两个方法咋一看都可以更新资 ...
- twistd 启动Python服务
twistd 启动Python服务 shell 脚本如下: #! /usr/bin/env sh MAIN_MODULE=pdf_task.py ROOT="/var/www/pdf/&qu ...
- pycharm 皮肤主题及个性化设置
1.设置IDE皮肤主题 File -> Settings -> IDE Settings -> Appearance -> Theme -> 选择“Alloy.IDEA ...
- ArcGIS Server 服务迁移、恢复
服务迁移与恢复 如果服务可以迁移,那么备份迁移所需文件,即可恢复原服务,所以"服务的迁移与恢复"."服务的备份"问题可以汇总为一个问题"怎样迁移服务. ...