php 正则表达式总结
例:
要求匹配标题
<div class="detail-hd">
<h3>
五皇冠 2010春装新品时尚T恤 长袖 女装长款T恤 热卖韩版长T 特价
</h3>
$reg="|<div class=\"detail-hd\">[\n\r\t]*<h3>[\n\r\t]*(.*)[\n\r\t]*</h3>|";
preg_match_all ($reg,$html,$out, PREG_PATTERN_ORDER);
/*
foreach ($out as $value){
foreach ($value as $value2){
echo ($value2."<br>");
}
}
*/
echo ($out[1][0]."<br>");
总结:
1、html中的两个尖括号不用转义"<>"
2、"冒号要转义,PHP语法需要
3、要配置括号(本身要转义\(,不转义就是正则的分组
4、反斜杠不用转义/
6、匹配回车[\n\r\t]
7、匹配包括回车在内的所有字符[\s\S]
8、单引号不用转义/
9、preg_match_all 的界定符可以是|或者#,如果用|,就不能表达分支条件了,故用#好些,如:
$reg="#http://.*?(\.jpg|\.gif)#i";
preg_match_all ($reg,$g_attributes,$out, PREG_PATTERN_ORDER);
10、ikmb
相关文档:
只能是window下.
从php 官网上下载 php_gd2.dll (5.2.2版的.)
替换你原来的gd2.
自动抓取网站页面并保存为一个图片.
实现代码如下:
<?php
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->FullScreen = true;
$browser->Nav ......
1 代理(Proxy)和委派(Delegate)的区别
http://hi.baidu.com/thinkinginlamp/blog/item/2297a7efcb52a31afdfa3cc2.html
2 开心农场架构介绍
http://www.javaeye.com/wiki/facebook/1766-five-minutes-happy-farm-structure-introduced
http://www.w2blog.net/view/455.html
3 SmugMug 的架构介绍
http://www.w2blo ......
AJAX无疑是2005年炒的最热的Web开发技术之一,当然,这个功劳离不开Google。我只是一个普通开发者,使用AJAX的地方不是特别多,我就简单的把我使用的心得说一下。(本文假设用户已经具有JavaScript、HTML、CSS等基本的Web开发能力)
[AJAX介绍]
Ajax是使用客户端脚本与Web服务器交换数据的Web应用开发方法。Web页 ......
function htmldecode($str)
{
if(empty($str)) return;
if($str=="") return $str;
$str=str_replace("&",chr(34),$str);
$str=str_replace(">",">",$str);
$str=str_replace("<","<",$str);
$str=str_replace("&","&",$str);
$str=str_replace(" ",chr(32),$str);
$str=str_replace(" ", ......
1、到微软官方去下载新的驱动,下载地址如下:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9
官方文档有描述:
Refer to the documentation that is installed with the driver for a description of the new features in this ......