<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>记录与PHP的PK经历 &#187; php</title>
	<atom:link href="http://www.pkphp.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pkphp.com</link>
	<description>PK with php!</description>
	<lastBuildDate>Fri, 27 May 2011 02:07:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</title>
		<link>http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/</link>
		<comments>http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 13:57:39 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[LAMP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[分词]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=897</guid>
		<description><![CDATA[非常佩服这位兄弟开发的开源php分词系统，现在终于发布1.0.0版本了。本版本的功能有了很大的加强，同时也简化了使用，仅一个php函数。现在转帖全部内容，对张宴表示强烈的支持!！ [文章/程序 作者：张宴 本文版本：v1.0 最后修改：2009.02.16 原文链接：http://blog.s135.com/post/398.htm] 名称：PHPCWS（PHP中文分词扩展） 协议：New BSD License 作者：张宴 网址：http://code.google.com/p/phpcws/ SVN：http://code.google.com/p/phpcws/source/browse/#svn/trunk/phpcws 一、PHPCWS 简介 1、什么是 PHPCWS ？ PHPCWS 是一款开源的PHP中文分词扩展，目前仅支持Linux/Unix系统。 PHPCWS 先使用“ICTCLAS 3.0 共享版中文分词算法”的API进行初次分词处理，再使用自行编写的“逆向最大匹配算法”对分词和进行词语合并处理，并增加标点符号过滤功能，得出分词结果。 ICTCLAS（Institute of Computing Technology, Chinese Lexical Analysis System）是中国科学院计算技术研究所在多年研究工作积累的基础上，基于多层隐马模型研制出的汉语词法分析系统，主要功能包括中文分词；词性标注；命 名实体识别；新词识别；同时支持用户词典。ICTCLAS经过五年精心打造，内核升级6次，目前已经升级到了ICTCLAS3.0，分词精度 98.45%，各种词典数据压缩后不到3M。ICTCLAS在国内973专家组组织的评测中活动获得了第一名，在第一届国际中文处理研究机构SigHan 组织的评测中都获得了多项第一名，是当前世界上最好的汉语词法分析器。 ICTCLAS 3.0 商业版是收费的，而免费提供的 ICTCLAS 3.0 共享版不开源，词库是根据人民日报一个月的语料得出的，很多词语不存在。所以本人对ICTCLAS分词后的结果，再采用逆向最大匹配算法，根据自己补充的 一个9万条词语的自定义词库（与ICTCLAS词库中的词语不重复），对ICTCLAS分词结果进行合并处理，输出最终分词结果。 由于 ICTCLAS 3.0 共享版只支持GBK编码，因此，如果是UTF-8编码的字符串，可以先用PHP的iconv函数转换成GBK编码，再用phpcws_split函数进行分词处理，最后转换回UTF-8编码。 2、PHPCWS 中文分词在线演示 演示网址：http://blog.s135.com/demo/phpcws/ 3、PHPCWS 分词速度及用途 初次使用时，Apache 或 php-cgi(FastCGI) 进程，需要加载一次词库到内存中，需要0.0X秒。58字节的一句话——“2009年2月13日，我编写了一款PHP中文分词扩展：PHPCWS [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php如何解析网页DOM？phpQurey给你搞定一切！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php通用xml解析类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SCWS简易中文分词系统</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>非常佩服这位兄弟开发的开源php分词系统，现在终于发布1.0.0版本了。本版本的功能有了很大的加强，同时也简化了使用，仅一个php函数。现在转帖全部内容，对<strong>张宴</strong>表示强烈的支持!！</p>
<p>[文章/程序 作者：张宴 本文版本：v1.0 最后修改：2009.02.16 原文链接：<a href="http://blog.s135.com/post/398.htm" target="_blank" rel="nofollow">http://blog.s135.com/post/398.htm</a>]</p>
<p>名称：PHPCWS（PHP中文分词扩展）<br />
协议：New BSD License<br />
作者：张宴<br />
网址：<a href="http://code.google.com/p/phpcws/" target="_blank" rel="nofollow">http://code.google.com/p/phpcws/</a><br />
SVN：<a href="http://code.google.com/p/phpcws/source/browse/#svn/trunk/phpcws" target="_blank" rel="nofollow">http://code.google.com/p/phpcws/source/browse/#svn/trunk/phpcws</a></p>
<p><span style="font-size: 14px;"><strong>一、PHPCWS 简介</strong></span></p>
<p><strong>1、什么是 PHPCWS ？</strong><br />
PHPCWS 是一款开源的PHP中文分词扩展，目前仅支持Linux/Unix系统。</p>
<p>PHPCWS 先使用“ICTCLAS 3.0 共享版中文分词算法”的API进行初次分词处理，再使用自行编写的“逆向最大匹配算法”对分词和进行词语合并处理，并增加标点符号过滤功能，得出分词结果。</p>
<p><a href="http://ictclas.org/sub_1_2.html" target="_blank" rel="nofollow">ICTCLAS</a>（Institute of Computing Technology, Chinese Lexical Analysis System）是中国科学院计算技术研究所在多年研究工作积累的基础上，基于多层隐马模型研制出的汉语词法分析系统，主要功能包括中文分词；词性标注；命 名实体识别；新词识别；同时支持用户词典。ICTCLAS经过五年精心打造，内核升级6次，目前已经升级到了ICTCLAS3.0，分词精度 98.45%，各种词典数据压缩后不到3M。ICTCLAS在国内973专家组组织的评测中活动获得了第一名，在第一届国际中文处理研究机构SigHan 组织的评测中都获得了多项第一名，是当前世界上最好的汉语词法分析器。</p>
<p>ICTCLAS 3.0 商业版是收费的，而免费提供的 ICTCLAS 3.0 共享版不开源，词库是根据人民日报一个月的语料得出的，很多词语不存在。所以本人对ICTCLAS分词后的结果，再采用逆向最大匹配算法，根据自己补充的 一个9万条词语的自定义词库（与ICTCLAS词库中的词语不重复），对ICTCLAS分词结果进行合并处理，输出最终分词结果。</p>
<p>由于 ICTCLAS 3.0 共享版只支持GBK编码，因此，如果是UTF-8编码的字符串，可以先用PHP的iconv函数转换成GBK编码，再用phpcws_split函数进行分词处理，最后转换回UTF-8编码。</p>
<p><strong>2、PHPCWS 中文分词在线演示</strong></p>
<p><span style="color: #ff0000;">演示网址：</span><a href="http://blog.s135.com/demo/phpcws/" target="_blank" rel="nofollow">http://blog.s135.com/demo/phpcws/</a></p>
<p><strong>3、PHPCWS 分词速度及用途</strong></p>
<p>初次使用时，Apache 或 php-cgi(FastCGI) 进程，需要加载一次词库到内存中，需要0.0X秒。58字节的一句话——“2009年2月13日，我编写了一款PHP中文分词扩展：PHPCWS 1.0.0。”，分词速度只需0.0003秒。</p>
<p>PHPCWS 属于《<a href="http://blog.s135.com/post/385.htm" target="_blank" rel="nofollow">亿级数据的高并发通用搜索引擎架构设计</a>》 的一部分，用作“搜索查询接口”的关键字分词处理。在此架构中，Sphinx索引引擎对于CJK（中日韩）语言支持一元切分，假设【反恐行动是国产主视角 射击网络游戏】这段文字，Sphinx会将其切成【反 恐 行 动 是 国 产 主 视 角 射 击 网 络 游 戏】，然后对每个字建立反向索引。如果用这句话中包含的字组成一个不存在的词语，例如【恐动】，也会被搜索到，所以搜索时，需要加引号，例如搜索【&#8221;反恐 行动&#8221;】，就能完全匹配连在一起的四个字，不连续的【&#8221;恐动&#8221;】就不会被搜索到。但是，这样还有一个问题，搜索【&#8221;反恐行动游戏&#8221;】或【&#8221;国产网络游 戏&#8221;】就会搜索不到。所以，我在搜索层写了个PHP中文分词扩展，搜索“反恐行动游戏”、“国产网络游戏”，会被PHPCWS中文分词函数分别切分为“反 恐行动 游戏”、“国产 网络游戏”，这时候，用PHP函数给以空格分隔的词语加上引号，去搜索【&#8221;反恐行动&#8221; &#8220;游戏&#8221;】或【&#8221;国产&#8221; &#8220;网络游戏&#8221;】，就能搜索到这条记录了。由于PHPCWS位于搜索层，中文分词词库发生增、删、改，只需平滑重启一次Web服务器或php-cgi进程即 可，无需重建搜索索引。</p>
<p>根据上述情况，对于那些采用二元交叉切分的搜索引擎，PHPCWS用在前端搜索层对用户输入的搜索关键字、短语进行分词处理，同样适合。PHPCWS开发的目的正在于此，对于短句、小文本中文分词切分，速度非常之快。</p>
<p><strong>4、自定义词库</strong></p>
<p>自定义词库名称为<a href="http://code.google.com/p/phpcws/source/browse/trunk/phpcws-dict/userdict.tch" target="_blank" rel="nofollow">userdict.tch</a>，格式为 Tokyo Cabinet DBM 的 Abstract key-value 内存哈希数据库（key为GBK编码的词语名词，value为词频。目前词频均填1，暂时用不上）。自定义词库的修改在安装步骤中会详细介绍。</p>
<hr /><span style="font-size: 14px;"><strong>二、PHPCWS 1.0.0 安装步骤</strong></span></p>
<p><strong>1、安装 Tokyo Cabinet 数据库：</strong></p>
<div style="border: 1px dashed #00a0c6; margin: 5px 5px 0px; padding: 3px; background-color: #ffffff;">wget <a href="http://tokyocabinet.sourceforge.net/tokyocabinet-1.4.5.tar.gz" target="_blank" rel="nofollow">http://tokyocabinet.sourceforge.net/tokyocabinet-1.4.5.tar.gz</a><br />
tar zxvf tokyocabinet-1.4.5.tar.gz<br />
cd tokyocabinet-1.4.5/<br />
./configure &#8211;prefix=/usr/local/tokyocabinet-1.4.5<br />
make &amp;&amp; make install<br />
mkdir -p /usr/local/tokyocabinet-1.4.5/lib/static/<br />
cp -f /usr/local/tokyocabinet-1.4.5/lib/*.a /usr/local/tokyocabinet-1.4.5/lib/static/<br />
echo &#8220;/usr/local/tokyocabinet-1.4.5/lib&#8221; &gt;&gt; /etc/ld.so.conf<br />
/sbin/ldconfig<br />
cd ../</div>
<p><strong>2、安装 PHPCWS 扩展：</strong></p>
<div style="border: 1px dashed #00a0c6; margin: 5px 5px 0px; padding: 3px; background-color: #ffffff;">wget <a href="http://phpcws.googlecode.com/files/phpcws-1.0.0.tar.gz" target="_blank" rel="nofollow">http://phpcws.googlecode.com/files/phpcws-1.0.0.tar.gz</a><br />
tar zxvf phpcws-1.0.0.tar.gz<br />
cd phpcws-1.0.0/<br />
/usr/local/webserver/php/bin/phpize<br />
./configure &#8211;with-php-config=/usr/local/webserver/php/bin/php-config &#8211;with-tc=/usr/local/tokyocabinet-1.4.5<br />
make &amp;&amp; make install<br />
cd ../</div>
<p>注：其中/usr/local/webserver/php/为您的PHP安装目录。</p>
<p><strong>3、安装 ICTCLAS 3.0 词库和 PHPCWS 自定义词库（词库汉字编码均为GBK）：</strong></p>
<div style="border: 1px dashed #00a0c6; margin: 5px 5px 0px; padding: 3px; background-color: #ffffff;">cd /usr/local/<br />
wget <a href="http://phpcws.googlecode.com/files/phpcws-dict-1.0.0.tar.gz" target="_blank" rel="nofollow">http://phpcws.googlecode.com/files/phpcws-dict-1.0.0.tar.gz</a><br />
tar zxvf phpcws-dict-1.0.0.tar.gz<br />
mv phpcws-dict-1.0.0 phpcws</div>
<p>您可以往自定义词库内增加自己的词语，方法如下：</p>
<div style="border: 1px dashed #00a0c6; margin: 5px 5px 0px; padding: 3px; background-color: #ffffff;">cd /usr/local/phpcws/</p>
<p>#如果userdict.tch已经被PHP加载，请拷贝一个备份<br />
cp userdict.tch userdict_new.tch</p>
<p>#添加新词语<br />
/usr/local/tokyocabinet-1.4.5/bin/tcamgr put userdict_new.tch 词语一 1<br />
/usr/local/tokyocabinet-1.4.5/bin/tcamgr put userdict_new.tch 词语二 1</p>
<p>查询某个词语是否已经在词库内<br />
/usr/local/tokyocabinet-1.4.5/bin/tcamgr get userdict_new.tch 词语名词</p>
<p>#删除一个词语<br />
/usr/local/tokyocabinet-1.4.5/bin/tcamgr out userdict_new.tch 词语名称</p>
<p>#将修改后的新词库覆盖回原词库<br />
mv userdict_new.tch userdict.tch</p>
<p>#重启您的Apache服务器，或php-cgi(FastCGI)进程。<br />
#例如重启php-cgi(FastCGI)进程：<br />
/usr/local/webserver/php/sbin/php reload</p></div>
<p>您可以从<a href="http://pinyin.sogou.com/dict/" target="_blank" rel="nofollow">搜狗细胞词库网站</a>下载自己需要的行业分类文本词库，整合到PHPCWS自定义词库中。</p>
<p><strong>4、修改您的php.ini文件，增加以下几行内容：</strong></p>
<div style="border: 1px dashed #00a0c6; margin: 5px 5px 0px; padding: 3px; background-color: #ffffff;">[phpcws]<br />
extension = &#8220;phpcws.so&#8221;<br />
phpcws.dict_path = &#8220;/usr/local/phpcws&#8221;</div>
<p><strong>5、重启您的Apache服务器，或php-cgi(FastCGI)进程</strong></p>
<p><strong>6、查看您的phpinfo信息，如果搜索到以下内容，则表明安装成功：</strong></p>
<p><a href="http://blog.s135.com/attachment/200902/phpcws.gif" target="_blank" rel="nofollow"><img class="insertimage" title="点击在新窗口中浏览此图片" src="http://blog.s135.com/attachment/200902/phpcws.gif" border="0" alt="点击在新窗口中浏览此图片" /></a></p>
<hr /><span style="font-size: 14px;"><strong>三、PHPCWS 1.0.0 调用方式</strong></span></p>
<p><strong>1、PHPCWS扩展拥有一个PHP函数：</strong><br />
string <span style="color: #ff0000;">phpcws_split</span> ( string <span style="color: #00008b;">$text</span> [, string <span style="color: #00008b;">$interpunction</span> ] )</p>
<p><strong>参数说明：</strong><br />
<span style="color: #00008b;">$text</span> 为GBK编码的文本内容；</p>
<p><span style="color: #00008b;">$interpunction</span> 为可选参数，用来控制是否过滤标点符号。<br />
①、值为空时，表示不过滤；</p>
<p>②、值为&#8221;default&#8221;时，过滤掉默认的标点符号，即以下标点符号：<br />
,.!！＂＃￥％＆｀＇（）〔〕〈〉《》「」『』〖〗【】．＊＋，－．。、？…—·ˉˇ¨‘’“”々～‖∶＂／：；｜〃＜＝＞？＠［＼］＾＿｀｛｜｝￣</p>
<p>③、值为其他字符串时，表示过滤掉自定义的标点符号，例如值为&#8221;,.!，。！&#8221;即过滤掉半角、全角的逗号、句号、感叹号。</p>
<p><strong>2、PHP中文分词实例：</strong></p>
<p>①、对GBK编码的字符串进行中文分词处理（example_gbk.php）：</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;?php </span></span></li>
<li><span>@header(<span class="string">&#8216;Content-Type: text/html; charset=gb2312&#8242;</span><span>); </span></span></li>
<li class="alt"><span><span class="vars">$text</span><span> = </span><span class="string">&#8220;2009年2月13日，我编写了一款PHP中文分词扩展：PHPCWS 1.0.0。&#8221;</span><span>; </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="string">&#8220;分词结果为：&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li><span><span class="vars">$result</span><span> = phpcws_split(</span><span class="vars">$text</span><span>); </span></span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="vars">$result</span><span> . </span><span class="string">&#8220;&lt;BR&gt;&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="string">&#8220;过滤掉默认标点符号的分词结果为：&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li><span><span class="vars">$result</span><span> = phpcws_split(</span><span class="vars">$text</span><span>, </span><span class="string">&#8220;default&#8221;</span><span>); </span></span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="vars">$result</span><span> . </span><span class="string">&#8220;&lt;BR&gt;&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="string">&#8220;过滤掉全角逗号与冒号的分词结果为：&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li><span><span class="vars">$result</span><span> = phpcws_split(</span><span class="vars">$text</span><span>, </span><span class="string">&#8220;，：&#8221;</span><span>); </span></span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="vars">$result</span><span> . </span><span class="string">&#8220;&lt;BR&gt;&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li><span>?&gt; </span></li>
</ol>
</div>
<p><textarea class="php" style="display: none;" cols="100" rows="15" name="code">&lt;?php @header(&#8216;Content-Type: text/html; charset=gb2312&#8242;); $text = &#8220;2009年2月13日，我编写了一款PHP中文分词扩展：PHPCWS 1.0.0。&#8221;;  echo &#8220;分词结果为：&lt;BR&gt;&#8221;; $result = phpcws_split($text); echo $result . &#8220;&lt;BR&gt;&lt;BR&gt;&#8221;;  echo &#8220;过滤掉默认标点符号的分词结果为：&lt;BR&gt;&#8221;; $result = phpcws_split($text, &#8220;default&#8221;); echo $result . &#8220;&lt;BR&gt;&lt;BR&gt;&#8221;;  echo &#8220;过滤掉全角逗号与冒号的分词结果为：&lt;BR&gt;&#8221;; $result = phpcws_split($text, &#8220;，：&#8221;); echo $result . &#8220;&lt;BR&gt;&lt;BR&gt;&#8221;; ?&gt;</textarea><br />
②、对UTF-8编码的字符串进行中文分词处理（example_utf8.php）：</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;?php </span></span></li>
<li><span>@header(<span class="string">&#8216;Content-Type: text/html; charset=utf-8&#8242;</span><span>); </span></span></li>
<li class="alt"><span><span class="vars">$text</span><span> = </span><span class="string">&#8220;2009年2月13日，我编写了一款PHP中文分词扩展：PHPCWS 1.0.0。&#8221;</span><span>; </span></span></li>
<li><span><span class="vars">$text</span><span> = iconv(</span><span class="string">&#8220;UTF-8&#8243;</span><span>, </span><span class="string">&#8220;GBK//IGNORE&#8221;</span><span>, </span><span class="vars">$text</span><span>); </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="func">echo</span><span> </span><span class="string">&#8220;分词结果为：&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span><span class="vars">$result</span><span> = phpcws_split(</span><span class="vars">$text</span><span>); </span></span></li>
<li><span><span class="vars">$result</span><span> = iconv(</span><span class="string">&#8220;GBK&#8221;</span><span>, </span><span class="string">&#8220;UTF-8//IGNORE&#8221;</span><span>, </span><span class="vars">$result</span><span>); </span></span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="vars">$result</span><span> . </span><span class="string">&#8220;&lt;BR&gt;&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="string">&#8220;过滤掉默认标点符号的分词结果为：&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li><span><span class="vars">$result</span><span> = phpcws_split(</span><span class="vars">$text</span><span>, </span><span class="string">&#8220;default&#8221;</span><span>); </span></span></li>
<li class="alt"><span><span class="vars">$result</span><span> = iconv(</span><span class="string">&#8220;GBK&#8221;</span><span>, </span><span class="string">&#8220;UTF-8//IGNORE&#8221;</span><span>, </span><span class="vars">$result</span><span>); </span></span></li>
<li><span><span class="func">echo</span><span> </span><span class="vars">$result</span><span> . </span><span class="string">&#8220;&lt;BR&gt;&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="func">echo</span><span> </span><span class="string">&#8220;过滤掉全角逗号与冒号的分词结果为：&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span><span class="vars">$result</span><span> = phpcws_split(</span><span class="vars">$text</span><span>, </span><span class="string">&#8220;，：&#8221;</span><span>); </span></span></li>
<li><span><span class="vars">$result</span><span> = iconv(</span><span class="string">&#8220;GBK&#8221;</span><span>, </span><span class="string">&#8220;UTF-8//IGNORE&#8221;</span><span>, </span><span class="vars">$result</span><span>); </span></span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="vars">$result</span><span> . </span><span class="string">&#8220;&lt;BR&gt;&lt;BR&gt;&#8221;</span><span>; </span></span></li>
<li><span>?&gt; </span></li>
</ol>
</div>
<p><textarea class="php" style="display: none;" cols="100" rows="15" name="code">&lt;?php @header(&#8216;Content-Type: text/html; charset=utf-8&#8242;); $text = &#8220;2009年2月13日，我编写了一款PHP中文分词扩展：PHPCWS 1.0.0。&#8221;; $text = iconv(&#8220;UTF-8&#8243;, &#8220;GBK//IGNORE&#8221;, $text);  echo &#8220;分词结果为：&lt;BR&gt;&#8221;; $result = phpcws_split($text); $result = iconv(&#8220;GBK&#8221;, &#8220;UTF-8//IGNORE&#8221;, $result); echo $result . &#8220;&lt;BR&gt;&lt;BR&gt;&#8221;;  echo &#8220;过滤掉默认标点符号的分词结果为：&lt;BR&gt;&#8221;; $result = phpcws_split($text, &#8220;default&#8221;); $result = iconv(&#8220;GBK&#8221;, &#8220;UTF-8//IGNORE&#8221;, $result); echo $result . &#8220;&lt;BR&gt;&lt;BR&gt;&#8221;;  echo &#8220;过滤掉全角逗号与冒号的分词结果为：&lt;BR&gt;&#8221;; $result = phpcws_split($text, &#8220;，：&#8221;); $result = iconv(&#8220;GBK&#8221;, &#8220;UTF-8//IGNORE&#8221;, $result); echo $result . &#8220;&lt;BR&gt;&lt;BR&gt;&#8221;; ?&gt;</textarea><br />
输出结果为：</p>
<div style="border: 1px dashed #00a0c6; margin: 5px 5px 0px; padding: 3px; background-color: #ffffff;">分词结果为：<br />
2009年 2月 13日 ， 我 编写 了 一款 PHP 中文 分词 扩展 ： PHPCWS 1.0.0 。</p>
<p>过滤掉默认标点符号的分词结果为：<br />
2009年 2月 13日 我 编写 了 一款 PHP 中文 分词 扩展 PHPCWS 1.0.0</p>
<p>过滤掉全角逗号与冒号的分词结果为：<br />
2009年 2月 13日 我 编写 了 一款 PHP 中文 分词 扩展 PHPCWS 1.0.0 。</p></div>
<p>以上两个实例PHP程序文件可以从SVN中获取：</p>
<div style="border: 1px dashed #00a0c6; margin: 5px 5px 0px; padding: 3px; background-color: #ffffff;">svn checkout <a href="http://phpcws.googlecode.com/svn/trunk/php-example/" target="_blank" rel="nofollow">http://phpcws.googlecode.com/svn/trunk/php-example/</a> php-example</div>
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/'>SCWS简易中文分词系统</a></li>
<li><a href='http://www.pkphp.com/2009/01/21/php-dom-phpqurey/'>php如何解析网页DOM？phpQurey给你搞定一切！</a></li>
<li><a href='http://www.pkphp.com/2008/09/17/php-generic-xml-parser/'>php通用xml解析类</a></li>
<li><a href='http://www.pkphp.com/2008/09/03/spy-getstring-function/'>蝈蝈采集程序核心代码：任意字符串截取函数</a></li>
<li><a href='http://www.pkphp.com/2008/08/11/ubuntu%e4%b8%8b%e5%ae%89%e8%a3%85-apachephpmysql%e6%96%87%e6%9c%ac%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%81/'>Ubuntu下安装 apache+php+mysql文本服务器！</a></li>
</ul>
<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="http://www.pkphp.com/" style="font-size: 13px;">http://www.pkphp.com/</a>(2)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="php 中文分词" style="font-size: 13px;">php 中文分词</a>(8)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="php中文分词" style="font-size: 13px;">php中文分词</a>(1)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="php分词" style="font-size: 13px;">php分词</a>(2)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="ictclas 3.0" style="font-size: 13px;">ictclas 3.0</a>(3)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="phpcws" style="font-size: 13px;">phpcws</a>(3)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="php　分词" style="font-size: 13px;">php　分词</a>(1)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="开源php" style="font-size: 13px;">开源php</a>(1)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="中文分词开源" style="font-size: 13px;">中文分词开源</a>(2)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="utf-8 逗号" style="font-size: 13px;">utf-8 逗号</a>(1)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="ictclas 过滤 标点" style="font-size: 13px;">ictclas 过滤 标点</a>(1)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="开源词库,下载" style="font-size: 13px;">开源词库,下载</a>(1)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="PHP 中文分词系统" style="font-size: 13px;">PHP 中文分词系统</a>(1)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="php 中英文 分词" style="font-size: 13px;">php 中英文 分词</a>(1)<a href="http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/" title="php 匹配中文句号" style="font-size: 13px;">php 匹配中文句号</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php如何解析网页DOM？phpQurey给你搞定一切！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php通用xml解析类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SCWS简易中文分词系统</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP如何判断ajax请求</title>
		<link>http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/</link>
		<comments>http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 05:29:27 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=846</guid>
		<description><![CDATA[如何在php中判断一个网页请求是ajax请求还是普通请求？你可以通过传递参数的方法来实现，例如使用如下网址请求： /path/to/pkphp.com/script.php?ajax 在php脚本中使用如下方法判断： if(isset($_GET['ajax'])) { ...这是一个ajax请求，然后... } else { ...这不是一个ajax请求，然后... } 通过传递_GET参数的方法简单实现了网页请求的判断。但是如果需要这样的功能，这个方法可能就有弊端，功能需求如下： 1.通过ajax请求的网页与普通请求的网页内容是不相同的 2.通过ajax请求的网页是为了方便用户操作，两种方法请求打开的网页必须的内容是相同的，只是ajax请求到的网页内容比较简化和使用，去除了网页的大框架模板。 3.这么做的目的是：用户在网页操作时通过ajax实现，而搜索引擎访问网页时（相当于普通打开网页），得到的内容是一个完整的网页（包含了网页的大框架模板）。 要完成上面的这个功能，就不能使用前面介绍的通过GET参数传递来判断了，如果使用GET传递来判断的话，用户ajax请求和普通网页请求都会是一样的内容，因为你不可能为一个链接设置一个带ajax判断参数和不带的URL。那么如何才能实现这个功能呢？必须通过服务器端PHP判断解决这个问题。也就是今天要说的PHP如何判断ajax请求。这个问题要解决有一个先决条件，那就是你使用的ajax框架必须是jquery。在jquery框架中，对于通过它的$.ajax, $.get, or $.post方法请求网页内容时，它会向服务器传递一个HTTP_X_REQUESTED_WITH的参数，你可以利用如下方法判断某个请求是ajax请求还是普通请求： if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) &#38;&#38; strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { ...这是一个ajax请求，然后... } else { ...这不是一个ajax请求，然后... } 利用这个来进行判断操作，可以使网页端的URL保持一致，但是能够对两种不同的请求却能够得到不同内容的网页。即实现了用户操作优化，又不影响搜索引擎收录，我觉得是一个很棒的解决方案！ 这里有一个另外需要注意的问题，就是如果你的jquery请求是通过iframe打开网页的，那么HTTP_X_REQUESTED_WITH参数不会被传递，也就是说你没有办法判断请求的类型。 Related items [转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦 php如何解析网页DOM？phpQurey给你搞定一切！ php通用xml解析类 蝈蝈采集程序核心代码：任意字符串截取函数 php查询alexa排名的代码 http://www.pkphp.com/(2)php 判断是否Ajax请求(1)WordPress (1)php 判断 请求结束(1)ajax请求(1)php如何实现ajax(1)ajax 请求(4)PHP ajax(10)php 中如何判断请求方式(1)php 中如何判断请求方式是post还是get(1)如何判断 AJAX(2)php 判断 ajax(4)ajax 普通请求(1)HTTP_X_REQUESTED_WITH(5)php判断在线用户(1)<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F05%2F30%2Fgoogle-ajax-libraries-api%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fhow-to-determin-a-ajax-request-using-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Google AJAX Libraries API</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F07%2Fjquery-for-ajax-loading-message%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fhow-to-determin-a-ajax-request-using-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用juqery创建加载消息Using JQuery for an Ajax loading message</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fhow-to-determin-a-ajax-request-using-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fhow-to-determin-a-ajax-request-using-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php如何解析网页DOM？phpQurey给你搞定一切！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>如何在php中判断一个网页请求是ajax请求还是普通请求？你可以通过传递参数的方法来实现，例如使用如下网址请求：<br />
<code>/path/to/pkphp.com/script.php?ajax</code><br />
在php脚本中使用如下方法判断：<br />
<code>if(isset($_GET['ajax'])) {<br />
...这是一个ajax请求，然后...<br />
}<br />
else {<br />
...这不是一个ajax请求，然后...<br />
}</code><br />
通过传递_GET参数的方法简单实现了网页请求的判断。但是如果需要这样的功能，这个方法可能就有弊端，功能需求如下：<br />
<code>1.通过ajax请求的网页与普通请求的网页内容是不相同的<br />
2.通过ajax请求的网页是为了方便用户操作，两种方法请求打开的网页必须的内容是相同的，只是ajax请求到的网页内容比较简化和使用，去除了网页的大框架模板。<br />
3.这么做的目的是：用户在网页操作时通过ajax实现，而搜索引擎访问网页时（相当于普通打开网页），得到的内容是一个完整的网页（包含了网页的大框架模板）。</code><br />
要完成上面的这个功能，就不能使用前面介绍的通过GET参数传递来判断了，如果使用GET传递来判断的话，用户ajax请求和普通网页请求都会是一样的内容，因为你不可能为一个链接设置一个带ajax判断参数和不带的URL。那么如何才能实现这个功能呢？必须通过服务器端PHP判断解决这个问题。也就是今天要说的PHP如何判断ajax请求。这个问题要解决有一个先决条件，那就是<strong>你使用的ajax框架必须是jquery</strong>。在jquery框架中，对于通过它的$.ajax, $.get, or $.post方法请求网页内容时，它会向服务器传递一个HTTP_X_REQUESTED_WITH的参数，你可以利用如下方法判断某个请求是ajax请求还是普通请求：<br />
<code>if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) &amp;&amp; strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')<br />
{<br />
...这是一个ajax请求，然后...<br />
}<br />
else {<br />
...这不是一个ajax请求，然后...<br />
}</code><br />
利用这个来进行判断操作，可以使网页端的URL保持一致，但是能够对两种不同的请求却能够得到不同内容的网页。即实现了用户操作优化，又不影响搜索引擎收录，我觉得是一个很棒的解决方案！</p>
<p>这里有一个另外需要注意的问题，就是<strong>如果你的jquery请求是通过iframe打开网页的，那么HTTP_X_REQUESTED_WITH参数不会被传递</strong>，也就是说你没有办法判断请求的类型。<br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/'>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</a></li>
<li><a href='http://www.pkphp.com/2009/01/21/php-dom-phpqurey/'>php如何解析网页DOM？phpQurey给你搞定一切！</a></li>
<li><a href='http://www.pkphp.com/2008/09/17/php-generic-xml-parser/'>php通用xml解析类</a></li>
<li><a href='http://www.pkphp.com/2008/09/03/spy-getstring-function/'>蝈蝈采集程序核心代码：任意字符串截取函数</a></li>
<li><a href='http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/'>php查询alexa排名的代码</a></li>
</ul>
<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="http://www.pkphp.com/" style="font-size: 13px;">http://www.pkphp.com/</a>(2)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="php 判断是否Ajax请求" style="font-size: 13px;">php 判断是否Ajax请求</a>(1)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="WordPress " style="font-size: 13px;">WordPress </a>(1)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="php 判断 请求结束" style="font-size: 13px;">php 判断 请求结束</a>(1)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="ajax请求" style="font-size: 13px;">ajax请求</a>(1)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="php如何实现ajax" style="font-size: 13px;">php如何实现ajax</a>(1)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="ajax 请求" style="font-size: 13px;">ajax 请求</a>(4)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="PHP ajax" style="font-size: 13px;">PHP ajax</a>(10)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="php 中如何判断请求方式" style="font-size: 13px;">php 中如何判断请求方式</a>(1)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="php 中如何判断请求方式是post还是get" style="font-size: 13px;">php 中如何判断请求方式是post还是get</a>(1)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="如何判断 AJAX" style="font-size: 13px;">如何判断 AJAX</a>(2)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="php 判断 ajax" style="font-size: 13px;">php 判断 ajax</a>(4)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="ajax 普通请求" style="font-size: 13px;">ajax 普通请求</a>(1)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="HTTP_X_REQUESTED_WITH" style="font-size: 13px;">HTTP_X_REQUESTED_WITH</a>(5)<a href="http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/" title="php判断在线用户" style="font-size: 13px;">php判断在线用户</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F05%2F30%2Fgoogle-ajax-libraries-api%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fhow-to-determin-a-ajax-request-using-php%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Google AJAX Libraries API</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F07%2Fjquery-for-ajax-loading-message%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fhow-to-determin-a-ajax-request-using-php%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用juqery创建加载消息Using JQuery for an Ajax loading message</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fhow-to-determin-a-ajax-request-using-php%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fhow-to-determin-a-ajax-request-using-php%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php如何解析网页DOM？phpQurey给你搞定一切！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php如何解析网页DOM？phpQurey给你搞定一切！</title>
		<link>http://www.pkphp.com/2009/01/21/php-dom-phpqurey/</link>
		<comments>http://www.pkphp.com/2009/01/21/php-dom-phpqurey/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 13:50:06 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[phpQurey]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=841</guid>
		<description><![CDATA[大名鼎鼎的jquery已经3岁了，他的出现让浏览器端的UI应用到达了新的水平，让javascript更加简单、方便得到应用。 jQuery由美国人John Resig创建，至今已吸引了来自世界各地的众多javascript高手加入其team。包括来自德国的J&#38;ouml;rn Zaefferer，罗马尼亚的Stefan Petre等等。 jQuery是继prototype之后又一个优秀的Javascrīpt框架。其宗旨是——WRITE LESS,DO MORE,写更少的代码,做更多的事情。 它是轻量级的js库(压缩后只有21k) ，这是其它的js库所不及的，它兼容CSS3，还兼容各种浏览器 （IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+）。 jQuery是一个快速的，简洁的javaScript库，使用户能更方便地处理HTML documents、events、实现动画效果，并且方便地为网站提供AJAX交互。 jQuery还有一个比较大的优势是，它的文档说明很全，而且各种应用也说得很详细，同时还有许多成熟的插件可供选择。 jQuery能够使用户的html页保持代码和html内容分离，也就是说，不用再在html里面插入一堆js来调用命令了，只需定义id即可。 要使用它首先要一个jQuery的库，也就是类包“jquery.js”，有了它我们就可以轻松的实现各种js功能了，它还有许多插件，可实现很多功能，所以说很强大嘛。 官方下载地址为：http://jquery.com/ 其实以我的理解，jquery是一个很简单的DOM解析器，它能够在浏览器端很方便的解析网页DOM结构。如何在php中解析网页DOM呢？phpQuery诞生了，它是一个利用php语言在服务器端实现了网页DOM解析的API。利用phpQuery可以像jquery一样方便的解析网页DOM，而且phpQuery与jquery语法和函数基本一致，也就是说如果你会了jquery的语法，那么你也就会了phpQuery的用法，太强大了！有了phpQuery，如果你要制作php采集程序，那就很简单了。 下面是phpQurey的基本用法： phpQuery::newDocumentFileXHTML('my-xhtml.html')->find('p'); $ul = pq('ul'); 创建phpQuery对象有以下方法可供选择： * phpQuery::newDocument($html, $contentType = null) 从html创建文档，如果$contentType不设置，那么根据$html自动解析编码，如果失败的话则使用utf-8编码. * phpQuery::newDocumentFile($file, $contentType = null)从文件创建文档. 与newDocument()类似 * phpQuery::newDocumentHTML($html, $charset = 'utf-8') * phpQuery::newDocumentXHTML($html, $charset = 'utf-8') * phpQuery::newDocumentXML($html, [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP中htmlentities跟htmlspecialchars的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php通用xml解析类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>大名鼎鼎的jquery已经3岁了，他的出现让浏览器端的UI应用到达了新的水平，让javascript更加简单、方便得到应用。</p>
<blockquote><p>jQuery由美国人John Resig创建，至今已吸引了来自世界各地的众多javascript高手加入其team。包括来自德国的J&amp;ouml;rn Zaefferer，罗马尼亚的Stefan Petre等等。</p>
<p>jQuery是继prototype之后又一个优秀的Javascrīpt框架。其宗旨是——WRITE LESS,DO MORE,写更少的代码,做更多的事情。<br />
它是轻量级的js库(压缩后只有21k) ，这是其它的js库所不及的，它兼容CSS3，还兼容各种浏览器 （IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+）。<br />
jQuery是一个快速的，简洁的javaScript库，使用户能更方便地处理HTML documents、events、实现动画效果，并且方便地为网站提供AJAX交互。<br />
jQuery还有一个比较大的优势是，它的文档说明很全，而且各种应用也说得很详细，同时还有许多成熟的插件可供选择。<br />
jQuery能够使用户的html页保持代码和html内容分离，也就是说，不用再在html里面插入一堆js来调用命令了，只需定义id即可。</p>
<p>要使用它首先要一个jQuery的库，也就是类包“jquery.js”，有了它我们就可以轻松的实现各种js功能了，它还有许多插件，可实现很多功能，所以说很强大嘛。</p></blockquote>
<blockquote><p>官方下载地址为：http://jquery.com/</p></blockquote>
<p>其实以我的理解，jquery是一个很简单的DOM解析器，它能够在浏览器端很方便的解析网页DOM结构。如何在php中解析网页DOM呢？<a href="http://code.google.com/p/phpquery/" target="_blank" rel="nofollow">phpQuery</a>诞生了，它是一个利用php语言在服务器端实现了网页DOM解析的API。利用<a href="http://code.google.com/p/phpquery/" target="_blank" rel="nofollow">phpQuery</a>可以像jquery一样方便的解析网页DOM，而且<a href="http://code.google.com/p/phpquery/" target="_blank" rel="nofollow">phpQuery</a>与jquery语法和函数基本一致，也就是说如果你会了jquery的语法，那么你也就会了phpQuery的用法，太强大了！有了<a href="http://code.google.com/p/phpquery/" target="_blank" rel="nofollow">phpQuery</a>，如果你要制作php采集程序，那就很简单了。</p>
<p>下面是phpQurey的基本用法：<br />
<code>phpQuery::newDocumentFileXHTML('my-xhtml.html')->find('p');<br />
$ul = pq('ul');</code><br />
创建phpQuery对象有以下方法可供选择：<br />
    <code>* phpQuery::newDocument($html, $contentType = null) 从html创建文档，如果$contentType不设置，那么根据$html自动解析编码，如果失败的话则使用utf-8编码.<br />
    * phpQuery::newDocumentFile($file, $contentType = null)从文件创建文档. 与newDocument()类似<br />
    * phpQuery::newDocumentHTML($html, $charset = 'utf-8')<br />
    * phpQuery::newDocumentXHTML($html, $charset = 'utf-8')<br />
    * phpQuery::newDocumentXML($html, $charset = 'utf-8')<br />
    * phpQuery::newDocumentPHP($html, $contentType = null)<br />
    * phpQuery::newDocumentFileHTML($file, $charset = 'utf-8')<br />
    * phpQuery::newDocumentFileXHTML($file, $charset = 'utf-8')<br />
    * phpQuery::newDocumentFileXML($file, $charset = 'utf-8')<br />
    * phpQuery::newDocumentFilePHP($file, $contentType) </code><br />
详细的使用方法请参见</p>
<h1 id="841_phpquery%e6%89%8b%e5_1" ><a rel="nofollow" href="http://code.google.com/p/phpquery/wiki/Manual">phpQuery手册</a></h1>
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/'>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</a></li>
<li><a href='http://www.pkphp.com/2008/09/17/php-generic-xml-parser/'>php通用xml解析类</a></li>
<li><a href='http://www.pkphp.com/2008/09/03/spy-getstring-function/'>蝈蝈采集程序核心代码：任意字符串截取函数</a></li>
<li><a href='http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/'>php查询alexa排名的代码</a></li>
<li><a href='http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/'>PHP中htmlentities跟htmlspecialchars的区别</a></li>
</ul>
<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="phpQuery" style="font-size: 13px;">phpQuery</a>(11)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="dom插件" style="font-size: 13px;">dom插件</a>(1)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="如何解析网页" style="font-size: 13px;">如何解析网页</a>(3)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="php dom" style="font-size: 13px;">php dom</a>(8)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="phpquery utf8" style="font-size: 13px;">phpquery utf8</a>(2)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="PHP 用DOM函数解析网页" style="font-size: 13px;">PHP 用DOM函数解析网页</a>(1)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="dom 采集" style="font-size: 13px;">dom 采集</a>(2)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="php 分析网页" style="font-size: 13px;">php 分析网页</a>(5)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="网页dom" style="font-size: 13px;">网页dom</a>(2)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="php xhtml dom" style="font-size: 13px;">php xhtml dom</a>(1)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="phpQuery API" style="font-size: 13px;">phpQuery API</a>(1)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="PHP网站如何解析" style="font-size: 13px;">PHP网站如何解析</a>(1)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="php与dom交互" style="font-size: 13px;">php与dom交互</a>(1)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="php post dom" style="font-size: 13px;">php post dom</a>(1)<a href="http://www.pkphp.com/2009/01/21/php-dom-phpqurey/" title="safari file dom" style="font-size: 13px;">safari file dom</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP中htmlentities跟htmlspecialchars的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php通用xml解析类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2009/01/21/php-dom-phpqurey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php通用xml解析类</title>
		<link>http://www.pkphp.com/2008/09/17/php-generic-xml-parser/</link>
		<comments>http://www.pkphp.com/2008/09/17/php-generic-xml-parser/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 12:15:25 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=647</guid>
		<description><![CDATA[使用代码，文件名：test_xml_parser.php

&#60;?php
/*
* test_xml_parser.php
*
* @(#) $Header: /ho...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP中htmlentities跟htmlspecialchars的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php如何解析网页DOM？phpQurey给你搞定一切！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>使用代码，文件名：test_xml_parser.php</p>
<blockquote><p>&lt;HTML&gt;<br />
  &lt;HEAD&gt;<br />
  &lt;TITLE&gt;Test for Manuel Lemos&#8217;s XML parser PHP class&lt;/TITLE&gt;<br />
  &lt;/HEAD&gt;<br />
  &lt;BODY&gt;<br />
  &lt;H1&gt;&lt;CENTER&gt;Test for Manuel Lemos&#8217;s XML parser PHP class&lt;/CENTER&gt;&lt;/H1&gt;<br />
  &lt;HR&gt;<br />
  &lt;?<br />
  require(&quot;xml_parser.php&quot;);</p>
<p>Function DumpArray(&amp;$array,$indent)<br />
  {<br />
  for(Reset($array),$node=0;$node&lt;count($array);Next($array),$node++)<br />
  {<br />
  echo $indent.&quot;\&quot;&quot;.Key($array).&quot;\&quot;=&quot;;<br />
  $value=$array[Key($array)];<br />
  if(GetType($value)==&quot;array&quot;)<br />
  {<br />
  echo &quot;\n&quot;.$indent.&quot;[\n&quot;;<br />
  DumpArray($value,$indent.&quot;\t&quot;);<br />
  echo $indent.&quot;]\n&quot;;<br />
  }<br />
  else<br />
  echo &quot;\&quot;$value\&quot;\n&quot;;<br />
  }<br />
  }</p>
<p>Function DumpStructure(&amp;$structure,&amp;$positions,$path)<br />
  {<br />
  echo &quot;[&quot;.$positions[$path][&quot;Line&quot;].&quot;,&quot;.$positions[$path][&quot;Column&quot;].&quot;,&quot;.$positions[$path][&quot;Byte&quot;].&quot;]&quot;;<br />
  if(GetType($structure[$path])==&quot;array&quot;)<br />
  {<br />
  echo &quot;&amp;lt;&quot;.$structure[$path][&quot;Tag&quot;].&quot;&amp;gt;&quot;;<br />
  for($element=0;$element&lt;$structure[$path][&quot;Elements&quot;];$element++)<br />
  DumpStructure($structure,$positions,$path.&quot;,$element&quot;);<br />
  echo &quot;&amp;lt;/&quot;.$structure[$path][&quot;Tag&quot;].&quot;&amp;gt;&quot;;<br />
  }<br />
  else<br />
  echo $structure[$path];<br />
  }</p>
<p> $file_name=&quot;example.xml&quot;;<br />
  $error=XMLParseFile($parser,$file_name,1,$file_name.&quot;.cache&quot;);<br />
  if(strcmp($error,&quot;&quot;))<br />
  echo &quot;&lt;H2&gt;&lt;CENTER&gt;Parser error: $error&lt;/CENTER&gt;&lt;/H2&gt;\n&quot;;<br />
  else<br />
  {<br />
  echo &quot;&lt;H2&gt;&lt;CENTER&gt;Parsed file structure&lt;/CENTER&gt;&lt;/H2&gt;\n&quot;;<br />
  echo &quot;&lt;P&gt;This example dumps the structure of the elements of an XML file by displaying the tags and data preceded by their positions in the file: line number, column number and file byte index.&lt;/P&gt;\n&quot;;<br />
  echo &quot;&lt;PRE&gt;&quot;;<br />
  DumpStructure($parser-&gt;structure,$parser-&gt;positions,&quot;0&quot;);<br />
  echo &quot;&lt;/PRE&gt;\n&quot;;<br />
  }<br />
  ?&gt;&lt;/BODY&gt;<br />
  &lt;/HTML&gt;</p>
</blockquote>
<p>+++++++++++++++++++++++++++++++++++++++++++++++++<br />
测试结果如下图：<br />
<a href="http://www.pkphp.com/wp-content/uploads/2008/09/xmlparser.gif"><img src="http://www.pkphp.com/wp-content/uploads/2008/09/xmlparser.gif" alt="" title="xmlparser" width="500" height="319" class="alignnone size-full wp-image-655" /></a><br />
+++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p>下载完整的php通用xml解析类：<a href="http://www.pkphp.com/wp-content/uploads/2008/09/xmlparser.zip">php-xmlparser</a><br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/'>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</a></li>
<li><a href='http://www.pkphp.com/2009/01/21/php-dom-phpqurey/'>php如何解析网页DOM？phpQurey给你搞定一切！</a></li>
<li><a href='http://www.pkphp.com/2008/09/03/spy-getstring-function/'>蝈蝈采集程序核心代码：任意字符串截取函数</a></li>
<li><a href='http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/'>php查询alexa排名的代码</a></li>
<li><a href='http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/'>PHP中htmlentities跟htmlspecialchars的区别</a></li>
</ul>
<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml" style="font-size: 13px;">php xml</a>(4)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php XML 解析 中文" style="font-size: 13px;">php XML 解析 中文</a>(1)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml解析类" style="font-size: 13px;">php xml解析类</a>(14)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="xml php 解析类" style="font-size: 13px;">xml php 解析类</a>(2)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml array 类" style="font-size: 13px;">php xml array 类</a>(1)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="zend framework parse XML" style="font-size: 13px;">zend framework parse XML</a>(1)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml to array" style="font-size: 13px;">php xml to array</a>(5)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml array" style="font-size: 13px;">php xml array</a>(9)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml 解析" style="font-size: 13px;">php xml 解析</a>(13)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml解析" style="font-size: 13px;">php xml解析</a>(5)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml 解析类" style="font-size: 13px;">php xml 解析类</a>(21)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml Indent" style="font-size: 13px;">php xml Indent</a>(1)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="XML php" style="font-size: 13px;">XML php</a>(1)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="php xml feed parser" style="font-size: 13px;">php xml feed parser</a>(1)<a href="http://www.pkphp.com/2008/09/17/php-generic-xml-parser/" title="xml path cache" style="font-size: 13px;">xml path cache</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP中htmlentities跟htmlspecialchars的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F21%2Fphp-dom-phpqurey%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php如何解析网页DOM？phpQurey给你搞定一切！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/09/17/php-generic-xml-parser/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>蝈蝈采集程序核心代码：任意字符串截取函数</title>
		<link>http://www.pkphp.com/2008/09/03/spy-getstring-function/</link>
		<comments>http://www.pkphp.com/2008/09/03/spy-getstring-function/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 13:38:30 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[百宝箱]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[字符串]]></category>
		<category><![CDATA[采集]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=595</guid>
		<description><![CDATA[今天无聊，公布自己的写的一个函数，这个函数是我的蝈蝈采集系统的核心函数。通过这个函数，你可以把获取到的html代码按照你想要的部分提取出来。这个函数的特点是简单易用，不需要正则。有了这个函数你也可以写采集程序了！哈哈！

代码如下：


&#60;?
/*
*  作者：askie
*  主页：http://www.pkphp.com
*  email...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux和windows下均可查询pr的php代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F10%2F%25E4%25BB%258A%25E6%2597%25A5%25E5%2588%25B0%25E5%258D%2597%25E4%25BA%25AC%25E4%25B8%258A%25E7%25BD%2591%25EF%25BC%258C%25E5%258F%2591%25E7%258E%25B0ff%25E5%2581%25B6%25E5%25B0%2594%25E6%2589%2593%25E5%25BC%2580%25E7%259A%2584%25E7%25BD%2591%25E9%25A1%25B5%25E5%2587%25BA%25E7%258E%25B0%25E5%25A6%2582%25E4%25B8%258B%25E4%25BB%25A3%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">今日到南京上网，发现偶尔打开的网页出现如下代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>今天无聊，公布自己的写的一个函数，这个函数是我的蝈蝈采集系统的核心函数。通过这个函数，你可以把获取到的html代码按照你想要的部分提取出来。这个函数的特点是简单易用，不需要正则。有了这个函数你也可以写采集程序了！哈哈！</p>
<p>代码如下：</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 800px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">&lt;?</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">/*</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">*  作者：askie</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">*  主页：http://www.pkphp.com</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">*  email or gtalk: imaskie[at]gmail.com</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">*</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">*  $str:任意字符串</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">*  $start:要替取的字符串之前的字符串</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">*  $end:要替取的字符串之前的字符串</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">*  $add:提取出来的结果是否加上$start和$end</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">*  返回数组</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">*/</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    function inContent($str,$start,$end,$add=<span style="color: #0000ff;">true</span>)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        $first=strstr($str,$start);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">if</span> ($first==<span style="color: #0000ff;">false</span>)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #0000ff;">return</span> array();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">else</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            $first=substr($first,strlen($start));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        $second=strstr($first,$end);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff;">if</span> ($second==<span style="color: #0000ff;">false</span>)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff;">if</span> ($add)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #0000ff;">return</span> array($start.$first);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff;">else</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #0000ff;">return</span> array($first);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        $final=substr($first,0,-strlen($second));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">if</span> ($add)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            $final=$start.$final.$end;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        $result[]=$final;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        $second=substr($second,strlen($end));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">if</span> (strstr($second,$start))</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            $result=array_merge($result,inContent(substr($second,strlen($end)),$start,$end,$add));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">return</span> $result;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">//例子</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">$html=<span style="color: #006080;">'&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">&lt;html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">&lt;head profile="http://gmpg.org/xfn/11"&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    &lt;title&gt;记录与PHP的PK经历 / PK with php!&lt;/title&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8" /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    &lt;link rel="stylesheet" type="text/css" media="screen,projection" href="http://www.pkphp.com/wp-content/themes/plaintxtblog/style.css" title="plaintxtBlog" /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    &lt;link rel="stylesheet" type="text/css" media="print" href="http://www.pkphp.com/wp-content/themes/plaintxtblog/print.css" /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    &lt;link rel="alternate" type="application/rss+xml" href="http://www.pkphp.com/feed/" title="记录与PHP的PK经历 RSS feed" /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    &lt;link rel="alternate" type="application/rss+xml" href="http://www.pkphp.com/comments/feed/" title="记录与PHP的PK经历 comments RSS feed" /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    &lt;link rel="pingback" href="http://www.pkphp.com/xmlrpc.php" /&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">';</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">//获取title</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">print_r(inContent($html,<span style="color: #006080;">'&lt;title&gt;'</span>,<span style="color: #006080;">'&lt;/title&gt;'</span>,<span style="color: #0000ff;">false</span>));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">/*</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">返回：</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">Array</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">(</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">    [0] =&gt; 记录与PHP的PK经历 / PK with php!</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">)</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">*/</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">print_r(inContent($html,<span style="color: #006080;">'&lt;title&gt;'</span>,<span style="color: #006080;">'&lt;/title&gt;'</span>,<span style="color: #0000ff;">true</span>));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">/*</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">返回：</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">Array</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">(</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">    [0] =&gt; &lt;title&gt;记录与PHP的PK经历 / PK with php!&lt;/title&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">)</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">*/</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">print_r(inContent($html,<span style="color: #006080;">'href="'</span>,<span style="color: #006080;">'"'</span>,<span style="color: #0000ff;">false</span>));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">/*</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">返回：</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">Array</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">(</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">    [0] =&gt; http://www.pkphp.com/wp-content/themes/plaintxtblog/style.css</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">    [1] =&gt; http://www.pkphp.com/wp-content/themes/plaintxtblog/print.css</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">    [2] =&gt; http://www.pkphp.com/feed/</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">    [3] =&gt; http://www.pkphp.com/comments/feed/</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">    [4] =&gt; http://www.pkphp.com/xmlrpc.php</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">)</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #008000;">*/</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">?&gt;</pre>
</div>
</div>
<p>这个函数对你有用么？<br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/'>php查询alexa排名的代码</a></li>
<li><a href='http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/'>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</a></li>
<li><a href='http://www.pkphp.com/2009/01/21/php-dom-phpqurey/'>php如何解析网页DOM？phpQurey给你搞定一切！</a></li>
<li><a href='http://www.pkphp.com/2008/09/27/how-to-sold-item-from-blog-of-self/'>如何在自己的博客上卖淘宝店铺的商品？如何免费推广自己淘宝商品？</a></li>
<li><a href='http://www.pkphp.com/2008/09/17/php-generic-xml-parser/'>php通用xml解析类</a></li>
</ul>
<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="wp采集" style="font-size: 13px;">wp采集</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="php 任意字符串" style="font-size: 13px;">php 任意字符串</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="采集程序需要的函数" style="font-size: 13px;">采集程序需要的函数</a>(2)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="蝈蝈采集" style="font-size: 13px;">蝈蝈采集</a>(6)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="php 采集程序" style="font-size: 13px;">php 采集程序</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="Email 采集 代码" style="font-size: 13px;">Email 采集 代码</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="pkphp" style="font-size: 13px;">pkphp</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="wordpress采集程序" style="font-size: 13px;">wordpress采集程序</a>(2)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="采集函数 pkphp" style="font-size: 13px;">采集函数 pkphp</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="wordpress 采集程序" style="font-size: 13px;">wordpress 采集程序</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="php email采集" style="font-size: 13px;">php email采集</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="采集程序" style="font-size: 13px;">采集程序</a>(2)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="php 采集 wp" style="font-size: 13px;">php 采集 wp</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="php title 截取函数" style="font-size: 13px;">php title 截取函数</a>(1)<a href="http://www.pkphp.com/2008/09/03/spy-getstring-function/" title="采集 核心函数" style="font-size: 13px;">采集 核心函数</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux和windows下均可查询pr的php代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F10%2F%25E4%25BB%258A%25E6%2597%25A5%25E5%2588%25B0%25E5%258D%2597%25E4%25BA%25AC%25E4%25B8%258A%25E7%25BD%2591%25EF%25BC%258C%25E5%258F%2591%25E7%258E%25B0ff%25E5%2581%25B6%25E5%25B0%2594%25E6%2589%2593%25E5%25BC%2580%25E7%259A%2584%25E7%25BD%2591%25E9%25A1%25B5%25E5%2587%25BA%25E7%258E%25B0%25E5%25A6%2582%25E4%25B8%258B%25E4%25BB%25A3%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">今日到南京上网，发现偶尔打开的网页出现如下代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/09/03/spy-getstring-function/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>php查询alexa排名的代码</title>
		<link>http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/</link>
		<comments>http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 15:37:22 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[alexa]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[查询]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=341</guid>
		<description><![CDATA[                  1: &#60;?PHP

         2: /*

         3: update: askie 

         4: Homepage: http://www.pkphp.com

         5: email: askie@sohu.com

         6: */

         7: class Alexa 

         8: {

         9: private $badclasses;

        10: private $site;

        11: private $cache;...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux和windows下均可查询pr的php代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">蝈蝈采集程序核心代码：任意字符串截取函数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php通用xml解析类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<blockquote><div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 106.28%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; height: 210px; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> &lt;?PHP</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #008000">/*</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span> <span style="color: #008000">update: askie </span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> <span style="color: #008000">Homepage: http://www.pkphp.com</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span> <span style="color: #008000">email: askie@sohu.com</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span> <span style="color: #008000">*/</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> <span style="color: #0000ff">class</span> Alexa </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span> <span style="color: #0000ff">private</span> $badclasses;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span> <span style="color: #0000ff">private</span> $site;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span> <span style="color: #0000ff">private</span> $cache;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span> function alexa() </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  15:</span> preg_match_all(<span style="color: #006080">'#\.([a-z0-9]+) \{#i'</span>,file_get_contents(<span style="color: #006080">'http://client.alexa.com/common/css/scramble.css'</span>),$<span style="color: #0000ff">this</span>-&gt;badclasses); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  17:</span> <span style="color: #0000ff">private</span> function descramble ($matches) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span> <span style="color: #0000ff">return</span> in_array($matches[1],$<span style="color: #0000ff">this</span>-&gt;badclasses[1])?<span style="color: #006080">''</span>:$matches[2];</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  19:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span> <span style="color: #0000ff">public</span> function stats ($site, $section = 4, $item = 5) </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  21:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span> <span style="color: #0000ff">if</span> (!is_array($<span style="color: #0000ff">this</span>-&gt;cache[$site])) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  23:</span> $items = array();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  24:</span> $html = preg_replace(<span style="color: #006080">'# #'</span>,<span style="color: #006080">''</span>,preg_replace(<span style="color: #006080">'#(?:&lt;|&lt;)!--.+?--(?:&gt;|&gt;)#'</span>,<span style="color: #006080">''</span>,file_get_contents(<span style="color: #006080">'http://www.alexa.com/data/details/traffic_details/'</span> . $site)));</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  25:</span> preg_match_all(<span style="color: #006080">'#</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  26:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  27:</span> .+? </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  28:</span> #'</span>,$html,$tables);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  29:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  30:</span> <span style="color: #0000ff">for</span> ($i=0,$len=count($tables[0]); $i&lt;$len; $i++) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  31:</span> preg_match_all(<span style="color: #006080">'#</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  32:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  33:</span> (.+?) </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  34:</span> #'</span>,$tables[0][$i],$info);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  35:</span> <span style="color: #0000ff">for</span> ($i2=0,$len2=count($info[1]); $i2&lt;$len2; $i2++) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  36:</span> $info[1][$i2] = preg_replace(<span style="color: #006080">'##'</span>,<span style="color: #006080">'$1 '</span>,$info[1][$i2]);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  37:</span> $items[$i][] = preg_replace_callback(<span style="color: #006080">'#(.+?)#im'</span>,array(get_class($<span style="color: #0000ff">this</span>), <span style="color: #006080">'descramble'</span>),$info[1][$i2]);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  38:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  39:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  40:</span> $<span style="color: #0000ff">this</span>-&gt;cache[$site] = $items;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  41:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  42:</span> <span style="color: #0000ff">if</span> ($section == 4 &amp;&amp; $item == 5) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  43:</span> <span style="color: #0000ff">return</span> $<span style="color: #0000ff">this</span>-&gt;cache[$site];</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  44:</span> } elseif ($item == 5) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  45:</span> <span style="color: #0000ff">return</span> $<span style="color: #0000ff">this</span>-&gt;cache[$site][$section];</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  46:</span> } <span style="color: #0000ff">else</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  47:</span> <span style="color: #0000ff">return</span> $<span style="color: #0000ff">this</span>-&gt;cache[$site][$section][$item];</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  48:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  49:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  50:</span> <span style="color: #0000ff">public</span> function threeMothAlexa($site)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  51:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  52:</span> $urlinfo=parse_url($site);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  53:</span> $site=$urlinfo[<span style="color: #006080">&quot;host&quot;</span>];</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  54:</span> $score=$<span style="color: #0000ff">this</span>-&gt;stats($site,1);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  55:</span> <span style="color: #0000ff">return</span> $score[2];</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  56:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  57:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  58:</span> <span style="color: #008000">//</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  59:</span> <span style="color: #008000">//$alexa = new Alexa();</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  60:</span> <span style="color: #008000">//print_r($alexa-&gt;stats('www.pkphp.com'));</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  61:</span> <span style="color: #008000">//print_r($alexa-&gt;stats('www.pkphp.com',1));</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  62:</span> <span style="color: #008000">//print_r($alexa-&gt;stats('www.pkphp.com',1,1));</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  63:</span> <span style="color: #008000">//print_r($alexa-&gt;threeMothAlexa('http://www.pkphp.com/'));</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  64:</span> ?&gt;</pre>
</p></div>
</p></div>
</blockquote>
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2008/09/03/spy-getstring-function/'>蝈蝈采集程序核心代码：任意字符串截取函数</a></li>
<li><a href='http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/'>linux和windows下均可查询pr的php代码</a></li>
<li><a href='http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/'>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</a></li>
<li><a href='http://www.pkphp.com/2009/01/21/php-dom-phpqurey/'>php如何解析网页DOM？phpQurey给你搞定一切！</a></li>
<li><a href='http://www.pkphp.com/2008/09/17/php-generic-xml-parser/'>php通用xml解析类</a></li>
</ul>
<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="php 查询 alexa排名" style="font-size: 13px;">php 查询 alexa排名</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="http://client.alexa.com/common/css/scramble.css" style="font-size: 13px;">http://client.alexa.com/common/css/scramble.css</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="http://client.alexa.com/common/css/scramble.css php" style="font-size: 13px;">http://client.alexa.com/common/css/scramble.css php</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="php Alexa 排名 代码" style="font-size: 13px;">php Alexa 排名 代码</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="PHP获取alexa排名代码" style="font-size: 13px;">PHP获取alexa排名代码</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="php? 查詢" style="font-size: 13px;">php? 查詢</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="php 查询 alexa" style="font-size: 13px;">php 查询 alexa</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="alexa php" style="font-size: 13px;">alexa php</a>(12)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="alexa php 代码" style="font-size: 13px;">alexa php 代码</a>(2)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="alexa php 查询" style="font-size: 13px;">alexa php 查询</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="php查询alexa排名" style="font-size: 13px;">php查询alexa排名</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="alexa代码" style="font-size: 13px;">alexa代码</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="Alexa排名PHP代码" style="font-size: 13px;">Alexa排名PHP代码</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="php查询代码" style="font-size: 13px;">php查询代码</a>(1)<a href="http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/" title="PHP查询排名" style="font-size: 13px;">PHP查询排名</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux和windows下均可查询pr的php代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F03%2Fspy-getstring-function%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">蝈蝈采集程序核心代码：任意字符串截取函数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php通用xml解析类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>linux和windows下均可查询pr的php代码</title>
		<link>http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/</link>
		<comments>http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 17:13:57 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pr]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[查询]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=324</guid>
		<description><![CDATA[                  1: &#60;?php

         2: // 7/25/2008 - Updated by Askie (http://www.pkphp.com/)

         3: // 3/20/2008 - Updated by Roger Collins (http://www.rogercollins.com/)

         4: // to remove graphing step

         5:&#160; 

         6: //PageRank Lookup v1.1 by HM2K (update: 31/0...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F30%2Flinux%25E4%25B8%258B%25E7%259A%2584%25E8%2584%259A%25E6%259C%25AC%25E6%2596%2587%25E4%25BB%25B6%25E8%25A6%2581%25E6%25B3%25A8%25E6%2584%258F%25E6%258D%25A2%25E8%25A1%258C%25E7%25AC%25A6%25E4%25B8%258Ewindows%25E4%25B8%258D%25E5%2590%258C%25EF%25BC%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux下的脚本文件要注意换行符与Windows不同！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F15%2Flinux%25E4%25B8%258Bsvn%25E5%2591%25BD%25E4%25BB%25A4%25E5%25A4%25A7%25E5%2585%25A8%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux下svn命令大全</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2010%2F01%2F01%2Flinux-vps-linode-com%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">便宜、方便、速度快的国外linux vps主机商Linode.com介绍</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<blockquote><div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> &lt;?php</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #008000">// 7/25/2008 - Updated by Askie (http://www.pkphp.com/)</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span> <span style="color: #008000">// 3/20/2008 - Updated by Roger Collins (http://www.rogercollins.com/)</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> <span style="color: #008000">// to remove graphing step</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span> <span style="color: #008000">//PageRank Lookup v1.1 by HM2K (update: 31/01/07)</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> <span style="color: #008000">//based on an alogoritham found here: http://pagerank.gamesaga.net/</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span> <span style="color: #0000ff">class</span> PageRank</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span> <span style="color: #008000">//settings - host and user agent</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span> var $googlehost=<span style="color: #006080">'toolbarqueries.google.com'</span>;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span> var $googleua=<span style="color: #006080">'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5'</span>;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  15:</span> <span style="color: #008000">//convert a string to a 32-bit integer</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span> function StrToNum($Str, $Check, $Magic) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  17:</span>     $Int32Unit = 4294967296;  <span style="color: #008000">// 2^32</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  19:</span>     $length = strlen($Str);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span>     <span style="color: #0000ff">for</span> ($i = 0; $i &lt; $length; $i++) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  21:</span>         $Check *= $Magic;     </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span>         <span style="color: #008000">//If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31), </span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  23:</span>         <span style="color: #008000">//  the result of converting to integer is undefined</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  24:</span>         <span style="color: #008000">//  refer to http://www.php.net/manual/en/language.types.integer.php</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  25:</span>         <span style="color: #0000ff">if</span> ($Check &gt;= $Int32Unit) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  26:</span>             $Check = ($Check - $Int32Unit * (<span style="color: #0000ff">int</span>) ($Check / $Int32Unit));</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  27:</span>             <span style="color: #008000">//if the check less than -2^31</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  28:</span>             $Check = ($Check &lt; -2147483648) ? ($Check + $Int32Unit) : $Check;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  29:</span>         }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  30:</span>         $Check += ord($Str{$i}); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  31:</span>     }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  32:</span>     <span style="color: #0000ff">return</span> $Check;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  33:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  34:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  35:</span> <span style="color: #008000">//genearate a hash for a url</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  36:</span> function HashURL($String) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  37:</span>     $Check1 = $<span style="color: #0000ff">this</span>-&gt;StrToNum($String, 0x1505, 0x21);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  38:</span>     $Check2 = $<span style="color: #0000ff">this</span>-&gt;StrToNum($String, 0, 0x1003F);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  39:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  40:</span>     $Check1 &gt;&gt;= 2;     </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  41:</span>     $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3FFFFC0 ) | ($Check1 &amp; 0x3F);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  42:</span>     $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3FFC00 ) | ($Check1 &amp; 0x3FF);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  43:</span>     $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3C000 ) | ($Check1 &amp; 0x3FFF);    </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  44:</span>     </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  45:</span>     $T1 = (((($Check1 &amp; 0x3C0) &lt;&lt; 4) | ($Check1 &amp; 0x3C)) &lt;&lt;2 ) | ($Check2 &amp; 0xF0F );</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  46:</span>     $T2 = (((($Check1 &amp; 0xFFFFC000) &lt;&lt; 4) | ($Check1 &amp; 0x3C00)) &lt;&lt; 0xA) | ($Check2 &amp; 0xF0F0000 );</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  47:</span>     </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  48:</span>     <span style="color: #0000ff">return</span> ($T1 | $T2);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  49:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  50:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  51:</span> <span style="color: #008000">//genearate a checksum for the hash string</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  52:</span> function CheckHash($Hashnum) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  53:</span>     $CheckByte = 0;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  54:</span>     $Flag = 0;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  55:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  56:</span>     $HashStr = sprintf(<span style="color: #006080">'%u'</span>, $Hashnum) ;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  57:</span>     $length = strlen($HashStr);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  58:</span>     </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  59:</span>     <span style="color: #0000ff">for</span> ($i = $length - 1;  $i &gt;= 0;  $i --) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  60:</span>         $Re = $HashStr{$i};</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  61:</span>         <span style="color: #0000ff">if</span> (1 === ($Flag % 2)) {              </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  62:</span>             $Re += $Re;     </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  63:</span>             $Re = (<span style="color: #0000ff">int</span>)($Re / 10) + ($Re % 10);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  64:</span>         }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  65:</span>         $CheckByte += $Re;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  66:</span>         $Flag ++;    </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  67:</span>     }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  68:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  69:</span>     $CheckByte %= 10;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  70:</span>     <span style="color: #0000ff">if</span> (0 !== $CheckByte) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  71:</span>         $CheckByte = 10 - $CheckByte;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  72:</span>         <span style="color: #0000ff">if</span> (1 === ($Flag % 2) ) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  73:</span>             <span style="color: #0000ff">if</span> (1 === ($CheckByte % 2)) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  74:</span>                 $CheckByte += 9;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  75:</span>             }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  76:</span>             $CheckByte &gt;&gt;= 1;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  77:</span>         }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  78:</span>     }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  79:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  80:</span>     <span style="color: #0000ff">return</span> <span style="color: #006080">'7'</span>.$CheckByte.$HashStr;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  81:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  82:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  83:</span> <span style="color: #008000">//return the pagerank checksum hash</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  84:</span> function getch($url) { <span style="color: #0000ff">return</span> $<span style="color: #0000ff">this</span>-&gt;CheckHash($<span style="color: #0000ff">this</span>-&gt;HashURL($url)); }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  85:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  86:</span> <span style="color: #008000">//return the pagerank figure</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  87:</span> function printrank($url) </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  88:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  89:</span>     $urlinfo=parse_url($url);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  90:</span>     $start=$urlinfo[<span style="color: #006080">&quot;scheme&quot;</span>]&lt;&gt;<span style="color: #006080">&quot;&quot;</span>?strlen($urlinfo[<span style="color: #006080">&quot;scheme&quot;</span>].<span style="color: #006080">&quot;://&quot;</span>):0;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  91:</span>     $url=substr($url,$start);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  92:</span>     </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  93:</span>     $pr = 0;    <span style="color: #008000">// default return</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  94:</span>     $ch = $<span style="color: #0000ff">this</span>-&gt;getch($url);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  95:</span>     $fp = fsockopen($<span style="color: #0000ff">this</span>-&gt;googlehost, 80, $errno, $errstr, 30);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  96:</span>     <span style="color: #0000ff">if</span> ($fp) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  97:</span>        $<span style="color: #0000ff">out</span> = <span style="color: #006080">&quot;GET /search?client=navclient-auto&amp;ch=$ch&amp;features=Rank&amp;q=info:$url HTTP/1.1
&quot;</span>;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  98:</span>        <span style="color: #008000">//echo &quot;&lt;pre&gt;$out&lt;/pre&gt;
&quot;; //debug only</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  99:</span>        $<span style="color: #0000ff">out</span> .= <span style="color: #006080">&quot;User-Agent: {$this-&gt;googleua}
&quot;</span>;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 100:</span>        $<span style="color: #0000ff">out</span> .= <span style="color: #006080">&quot;Host: {$this-&gt;googlehost}
&quot;</span>;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 101:</span>        $<span style="color: #0000ff">out</span> .= <span style="color: #006080">&quot;Connection: Close

&quot;</span>;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 102:</span>     </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 103:</span>        fwrite($fp, $<span style="color: #0000ff">out</span>);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 104:</span>        </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 105:</span>        <span style="color: #008000">//$pagerank = substr(fgets($fp, 128), 4); //debug only</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 106:</span>        <span style="color: #008000">//echo $pagerank; //debug only</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 107:</span>        <span style="color: #0000ff">while</span> (!feof($fp)) {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 108:</span>             $data = fgets($fp, 128);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 109:</span>             <span style="color: #008000">//echo $data;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 110:</span>             $pos = strpos($data, <span style="color: #006080">&quot;Rank_&quot;</span>);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 111:</span>             <span style="color: #0000ff">if</span>($pos === <span style="color: #0000ff">false</span>){} <span style="color: #0000ff">else</span>{</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 112:</span>                 $pr=substr($data, $pos + 9);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 113:</span>                 $pr=trim($pr);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 114:</span>                 $pr=str_replace(<span style="color: #006080">&quot;
&quot;</span>,<span style="color: #006080">''</span>,$pr);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 115:</span>                 <span style="color: #0000ff">return</span> $pr;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 116:</span>             }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 117:</span>        }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 118:</span>        <span style="color: #008000">//else { echo &quot;$errstr ($errno)&lt;br /&gt;
&quot;; } //debug only</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 119:</span>        fclose($fp);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 120:</span>     }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 121:</span>     <span style="color: #0000ff">return</span> $pr;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 122:</span>     }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 123:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 124:</span> <span style="color: #008000">//$gpr = new PageRank();</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 125:</span> //print_r($gpr-&gt;printrank(<span style="color: #006080">&quot;http://www.pkphp.com/&quot;</span>));</pre>
</p></div>
</p></div>
<p>
    <br />&lt;?</p>
</blockquote>
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/'>php查询alexa排名的代码</a></li>
<li><a href='http://www.pkphp.com/2008/09/03/spy-getstring-function/'>蝈蝈采集程序核心代码：任意字符串截取函数</a></li>
<li><a href='http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/'>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</a></li>
<li><a href='http://www.pkphp.com/2009/02/05/linux%e4%b8%8b%e5%a6%82%e4%bd%95%e9%87%8d%e5%90%af%e5%8a%a8%e7%bd%91%e7%bb%9c%e6%9c%8d%e5%8a%a1/'>linux下如何重启动网络服务</a></li>
<li><a href='http://www.pkphp.com/2009/01/24/how-to-determin-a-ajax-request-using-php/'>PHP如何判断ajax请求</a></li>
</ul>
<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="linux" style="font-size: 13px;">linux</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="php linux 和 windows" style="font-size: 13px;">php linux 和 windows</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="pagerank查询 php" style="font-size: 13px;">pagerank查询 php</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="php查询pr 代码" style="font-size: 13px;">php查询pr 代码</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="pr查询 代码" style="font-size: 13px;">pr查询 代码</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="中文URL PR值" style="font-size: 13px;">中文URL PR值</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="php pr" style="font-size: 13px;">php pr</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="php toolbarqueries.google.com" style="font-size: 13px;">php toolbarqueries.google.com</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="php 查询 pr" style="font-size: 13px;">php 查询 pr</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="pr查询代码 php" style="font-size: 13px;">pr查询代码 php</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="pr php google linux" style="font-size: 13px;">pr php google linux</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="PageRank Lookup v1.1 by HM2K" style="font-size: 13px;">PageRank Lookup v1.1 by HM2K</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="Windows下php版的查询代码" style="font-size: 13px;">Windows下php版的查询代码</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="Google PR查询代码" style="font-size: 13px;">Google PR查询代码</a>(1)<a href="http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/" title="php 查pr" style="font-size: 13px;">php 查pr</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F30%2Flinux%25E4%25B8%258B%25E7%259A%2584%25E8%2584%259A%25E6%259C%25AC%25E6%2596%2587%25E4%25BB%25B6%25E8%25A6%2581%25E6%25B3%25A8%25E6%2584%258F%25E6%258D%25A2%25E8%25A1%258C%25E7%25AC%25A6%25E4%25B8%258Ewindows%25E4%25B8%258D%25E5%2590%258C%25EF%25BC%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux下的脚本文件要注意换行符与Windows不同！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F15%2Flinux%25E4%25B8%258Bsvn%25E5%2591%25BD%25E4%25BB%25A4%25E5%25A4%25A7%25E5%2585%25A8%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux下svn命令大全</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2010%2F01%2F01%2Flinux-vps-linode-com%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Flinux%25E5%2592%258Cwindows%25E4%25B8%258B%25E5%259D%2587%25E5%258F%25AF%25E6%259F%25A5%25E8%25AF%25A2pr%25E7%259A%2584php%25E4%25BB%25A3%25E7%25A0%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">便宜、方便、速度快的国外linux vps主机商Linode.com介绍</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/07/25/linux%e5%92%8cwindows%e4%b8%8b%e5%9d%87%e5%8f%af%e6%9f%a5%e8%af%a2pr%e7%9a%84php%e4%bb%a3%e7%a0%81/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP中htmlentities跟htmlspecialchars的区别</title>
		<link>http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/</link>
		<comments>http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 13:25:57 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[htmlentities]]></category>
		<category><![CDATA[htmlspecialchars]]></category>
		<category><![CDATA[区别]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=117</guid>
		<description><![CDATA[很多人都以为htmlentities跟htmlspecialchars的功能是一样的，都是格式化html代码的，我以前也曾这么认为，但是今天我发现并不是这样的。

这两个函数在格式化带有英文字符的html代码的时候基本没啥问题，但是htmlentities对中文字符也不放过，这样得出来的结果是中文字符 部分变为一堆乱码。当时做英文站的时候根本就没觉...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php通用xml解析类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F11%2Fubuntu%25E4%25B8%258B%25E5%25AE%2589%25E8%25A3%2585-apachephpmysql%25E6%2596%2587%25E6%259C%25AC%25E6%259C%258D%25E5%258A%25A1%25E5%2599%25A8%25EF%25BC%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ubuntu下安装 apache+php+mysql文本服务器！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>很多人都以为htmlentities跟htmlspecialchars的功能是一样的，都是格式化html代码的，我以前也曾这么认为，但是今天我发现并不是这样的。</p>
<p>这两个函数在格式化带有英文字符的html代码的时候基本没啥问题，但是htmlentities对中文字符也不放过，这样得出来的结果是中文字符 部分变为一堆乱码。当时做英文站的时候根本就没觉察到这个问题，而今天公司的一个收藏站却因为有有非英文字符而出现了问题，我最终查出来是 htmlentities这个函数的问题，同时我也找到了htmlspecialchars这个函数。</p>
<p>对于这两个函数，php手册上都是英文做的解释，其中在htmlentities函数的说明部分有这么一段英文：</p>
<p>This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.</p>
<p>从这句话中我们也可以看出来这两个函数虽然基本功能差不多，但是还是有细微的差别在里面的。再仔细看htmlspecialchars函数里面的一段话：</p>
<p>The translations performed are:</p>
<p>‘&amp;’ (ampersand) becomes ‘&amp;’</p>
<p>‘”‘ (double quote) becomes ‘”‘ when ENT_NOQUOTES is not set.</p>
<p>”’ (single quote) becomes ”’ only when ENT_QUOTES is set.</p>
<p>‘&lt;’ (less than) becomes ‘&lt;’</p>
<p>‘&gt;’ (greater than) becomes ‘&gt;’<br />
可以了解到htmlspecialchars只转化上面这几个html代码，而htmlentities却会转化所有的html代码，连同里面的它无法识别的中文字符也给转化了。</p>
<p>我们可以拿一个简单的例子来做比较：</p>
<div class="hl-surround">
<blockquote>
<div class="hl-main"><span style="color: #00008b;">$str</span><span style="color: gray;">=</span><span style="color: #8b0000;">&#8216;</span><span style="color: red;">&lt;a href=&#8221;test.html&#8221;&gt;测试页面&lt;/a&gt;</span><span style="color: #8b0000;">&#8216;</span><span style="color: gray;">;<br />
</span><span style="color: green;">echo</span><span style="color: gray;"> </span><span style="color: blue;">htmlentities</span><span style="color: olive;">(</span><span style="color: #00008b;">$str</span><span style="color: olive;">)</span><span style="color: gray;">;<br />
</span></div>
</blockquote>
</div>
<div class="hl-surround">
<blockquote>
<div class="hl-main"><span style="color: #00008b;">$str</span><span style="color: gray;">=</span><span style="color: #8b0000;">&#8216;</span><span style="color: red;">&lt;a href=&#8221;test.html&#8221;&gt;测试页面&lt;/a&gt;</span><span style="color: #8b0000;">&#8216;</span><span style="color: gray;">;<br />
</span><span style="color: green;">echo</span><span style="color: gray;"> </span><span style="color: blue;">htmlspecialchars</span><span style="color: olive;">(</span><span style="color: #00008b;">$str</span><span style="color: olive;">)</span><span style="color: gray;">;<br />
</span></div>
</blockquote>
</div>
<p>有条件的朋友，可以分别运行一下上面的这两段代码，就可以看出两者的差别了。<br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/'>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</a></li>
<li><a href='http://www.pkphp.com/2009/01/21/php-dom-phpqurey/'>php如何解析网页DOM？phpQurey给你搞定一切！</a></li>
<li><a href='http://www.pkphp.com/2008/09/17/php-generic-xml-parser/'>php通用xml解析类</a></li>
<li><a href='http://www.pkphp.com/2008/09/03/spy-getstring-function/'>蝈蝈采集程序核心代码：任意字符串截取函数</a></li>
<li><a href='http://www.pkphp.com/2008/07/25/php%e6%9f%a5%e8%af%a2alexa%e6%8e%92%e5%90%8d%e7%9a%84%e4%bb%a3%e7%a0%81/'>php查询alexa排名的代码</a></li>
</ul>
<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="htmlentities和htmlspecialchars" style="font-size: 13px;">htmlentities和htmlspecialchars</a>(1)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="htmlspecialchars 中文" style="font-size: 13px;">htmlspecialchars 中文</a>(7)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="php htmlspecialchars htmlentities" style="font-size: 13px;">php htmlspecialchars htmlentities</a>(6)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="htmlentities 中文" style="font-size: 13px;">htmlentities 中文</a>(12)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="htmlspecialchars() php" style="font-size: 13px;">htmlspecialchars() php</a>(1)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="&lt;?php &lt;? 区别" style="font-size: 13px;">&lt;?php &lt;? 区别</a>(1)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="html php 区别" style="font-size: 13px;">html php 区别</a>(2)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="PHP中htmlentities跟htmlspecialchars的区别" style="font-size: 13px;">PHP中htmlentities跟htmlspecialchars的区别</a>(1)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="htmlentities跟htmlspecialchars的区别" style="font-size: 13px;">htmlentities跟htmlspecialchars的区别</a>(1)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="php htmlentities说明" style="font-size: 13px;">php htmlentities说明</a>(2)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="HTML entities" style="font-size: 13px;">HTML entities</a>(1)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="htmlentities中文" style="font-size: 13px;">htmlentities中文</a>(4)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="htmlentities php" style="font-size: 13px;">htmlentities php</a>(5)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="htmlentities" style="font-size: 13px;">htmlentities</a>(8)<a href="http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/" title="htmlspecialchars htmlentities 区别" style="font-size: 13px;">htmlspecialchars htmlentities 区别</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F17%2Fphp-generic-xml-parser%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php通用xml解析类</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F25%2Fphp%25E6%259F%25A5%25E8%25AF%25A2alexa%25E6%258E%2592%25E5%2590%258D%25E7%259A%2584%25E4%25BB%25A3%25E7%25A0%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php查询alexa排名的代码</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F11%2Fubuntu%25E4%25B8%258B%25E5%25AE%2589%25E8%25A3%2585-apachephpmysql%25E6%2596%2587%25E6%259C%25AC%25E6%259C%258D%25E5%258A%25A1%25E5%2599%25A8%25EF%25BC%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F30%2Fphp%25E4%25B8%25ADhtmlentities%25E8%25B7%259Fhtmlspecialchars%25E7%259A%2584%25E5%258C%25BA%25E5%2588%25AB%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Ubuntu下安装 apache+php+mysql文本服务器！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/06/30/php%e4%b8%adhtmlentities%e8%b7%9fhtmlspecialchars%e7%9a%84%e5%8c%ba%e5%88%ab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCWS简易中文分词系统</title>
		<link>http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/</link>
		<comments>http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 15:04:26 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[LAMP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SCWS]]></category>
		<category><![CDATA[中文]]></category>
		<category><![CDATA[分词]]></category>
		<category><![CDATA[简易]]></category>
		<category><![CDATA[系统]]></category>
		<category><![CDATA[词性]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=76</guid>
		<description><![CDATA[SCWS-1.x.x 自述文件 (Written by hightman)
HomePage: http://www.hightman.cn

$Id: README,v 1.1.1.1 2008/03/04 14:00:36 hightman Exp $

&#62; ----------------------------------------------------------- &#60;
1. 简介

2. 安装说明

3. API 使用说明

4. 配套工具

5. PHP 扩展安装说明

6. 代码...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fwordpress-seo-%25E4%25B8%25AD%25E6%2596%2587%25E6%258F%2592%25E4%25BB%25B6-v10%25E5%258F%2591%25E5%25B8%2583%25EF%25BC%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress SEO 中文插件 V1.0发布！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F29%2Fwordpress-seo-%25E4%25B8%25AD%25E6%2596%2587%25E6%258F%2592%25E4%25BB%25B6%25E8%25AE%25BE%25E8%25AE%25A1%25E7%25BB%2586%25E8%258A%2582%25E5%2585%25AC%25E5%25B8%2583%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress SEO 中文插件设计细节公布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F13%2Fwordpress-plugin-seo-chinese%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【原创】WordPress中文SEO插件 V0.8发布!</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>SCWS-1.x.x 自述文件 (Written by hightman)<br />
HomePage: http://www.hightman.cn</p>
<p>$Id: README,v 1.1.1.1 2008/03/04 14:00:36 hightman Exp $</p>
<p>&gt; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &lt;<br />
1. 简介</p>
<p>2. 安装说明</p>
<p>3. API 使用说明</p>
<p>4. 配套工具</p>
<p>5. PHP 扩展安装说明</p>
<p>6. 代码结构</p>
<p>7. rules.ini 规则集编写说明</p>
<p>&gt; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &lt;</p>
<p>[SCWS 简介]</p>
<p>SCWS 是 Simple Chinese Words Segmentation 的缩写（简易中文分词系统）。<br />
它是一套基于词频词典的机械中文分词引擎，它能将一整段的汉字基本正确的<br />
切分成词，因为词是汉语的基本语素单位，而书写的时候不像英语会在词之间<br />
用空格分开，所以如何准确快速的分词一直是中文分词的攻关难点。</p>
<p>本分词法并无太多创新成分，采用的是自己采集的词频词典，并辅以一定的专<br />
有名称，人名，地名，数字年代等规则识别来达到基本分词，经小范围测试大<br />
概准确率在 90% ~ 95% 之间，已能基本满足一些小型搜索引擎、关键字提取<br />
等场合运用。首次雏形版本发布于 2005 年底。</p>
<p>本系统支持的汉字编码包括 GBK、UTF-8</p>
<p>在线分词演示：<br />
G  B K: http://www.hightman.cn/demo/scws/v4.php<br />
UTF-8: http://www.hightman.cn/demo/scws/v48.php</p>
<p>详情可参看：http://www.hightman.cn/?scws</p>
<p>[安装说明]</p>
<p>以 Linux(FreeBSD) 操作系统为例</p>
<p>1. 取得 scws-1.0.0 的代码<br />
wget http://www.hightman.cn/down/logged/lscws-1.0.0.tar.gz</p>
<p>2. 解开压缩包<br />
[hightman@d1 ~]$ tar xvzf scws-1.0.0.tar.gz</p>
<p>3. 进入目录执行配置脚本和编译<br />
[hightman@d1 ~]$ cd scws-1.0.0<br />
[hightman@d1 ~]$ ./configure &#8211;prefix=/usr/local/scws ; make ; make install</p>
<p>注：这里和通用的 GNU 软件安装方式一样，具体选项参数执行 ./configure &#8211;help 查看。<br />
常用的三个选项为：<br />
&#8211;prefix=&lt;scws的安装目录&gt;<br />
&#8211;disable-mmap     &lt;这表示禁用 MMAP 来读取 xdb，在 debian, ubuntu 的部分 Linux 中建议关闭 mmap&gt;<br />
&#8211;enable-developer &lt;这表示以开发者模式编译，主要是用于调试编译时加入了 -g 选项及部分标准输出的信息&gt;</p>
<p>4. 顺利的话已经编译并安装成功到 /usr/local/scws 中了，执行下面命令看看文件是否存在<br />
[hightman@d1 ~]$ ls -al /usr/local/scws/lib/libscws.la</p>
<p>5. 试试执行 scws-cli 文件<br />
[hightman@d1 ~]$ /usr/local/scws/bin/scws -h<br />
scws (scws-cli/1.0.0)<br />
Simple Chinese Word Segmentation &#8211; Command line usage.<br />
Copyright (C)2007 by hightman.<br />
&#8230;</p>
<p>6. 生成词典<br />
在源代码目录树的 etc/ 目录下附上了词典的文本文件，编码为 GBK，使用前必须先转换成 xdb 格式。<br />
假设您在 源码目录中，请执行<br />
/usr/local/scws/bin/gen_scws_dict -h 查看词典生成帮助，调用指令(-c用于指定编码, gbk或utf8)：</p>
<p>/usr/local/scws/bin/gen_scws_dict -c gbk -i etc/dict_chs_gbk.txt -o /usr/local/scws/etc/dict_chs_gbk.xdb<br />
/usr/local/scws/bin/gen_scws_dict -c utf8 -i etc/dict_chs_utf8.txt -o /usr/local/scws/etc/dict_chs_utf8.xdb</p>
<p>执行需要一段时间，最终生成可用的 xdb 文件于 /usr/local/scws/etc/ 中</p>
<p>注：如果您需要使用 utf8 编码，请事先将 dict_chs_gbk.txt 转换成 utf8 编码再调用 gen_scws_dict 来转换。</p>
<p>7. 写个小程序测试一下<br />
[hightman@d1 ~]$ cat &gt; test.c<br />
#include &lt;scws.h&gt;<br />
main()<br />
{<br />
scws_t s;<br />
s = scws_new();<br />
scws_free(s);<br />
printf(&#8220;test ok!\n&#8221;);<br />
}</p>
<p>8. 编译测试程序<br />
gcc -o test -I/usr/local/scws/include -L/usr/local/scws/lib test.c -lscws<br />
./test</p>
<p>9. 好了，就可以用这套 API 了</p>
<p>&gt; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &lt;</p>
<p>[LibSCWS API 使用说明]</p>
<p>本说明由 hightman 编写于 2007.06.08<br />
网页版地址：http://www.hightman.cn/bbs/viewthread.php?tid=37</p>
<p>0. 概述<br />
Libscws 代码是当前 SCWS(简易中文分词) 算法使用C语言编写的链接库，<br />
目前仅基于 Unix 族的操作系统，可能必须适当修改才能运行在 Windows<br />
平台中。这套 scws 库没有外部扩展依赖，代码力争简洁高效，针对分词<br />
词典组织上做了一些优化。除分词外，由于分词词库采用的是自行设计的<br />
xdb 和 xtree 结构，故本库函数也可以用以 XDB 和 XTree 数据存取<br />
（另行介绍，暂时没有说明）。</p>
<p>1. 数据类型 （仅列出API中需要关注的部分）<br />
·scws 操作句柄，几乎所有的 API 函数都使用到它，不应尝试拷贝 scws_st 结构，不保证这类拷贝结果会有用。<br />
typedef struct<br />
{<br />
xdict_t d;<br />
rule_t r;<br />
unsigned char *mblen;<br />
unsigned int mode;<br />
unsigned char *txt;<br />
int len;<br />
int off;<br />
int wend;<br />
scws_res_t res0;<br />
scws_res_t res1;<br />
word_t **wmap;<br />
struct scws_zchar *zmap;<br />
} scws_st, *scws_t;<br />
struct scws_zchar<br />
{<br />
int start;<br />
int end;<br />
};<br />
注：xdict_t 和 rule_t 分别是词典和规则集的指针，可判断其是否为 NULL 来判断加载的成功与失败。<br />
·scws 系列结果集，每次 scws 返回的分词结果的数量都是不定的，直到返回结果为 NULL 才表示这次分词过程结束，这是一个单链表结构。<br />
typedef struct scws_result *scws_res_t;<br />
struct scws_result<br />
{<br />
int off;<br />
float idf;<br />
unsigned char len;<br />
char attr[3];<br />
scws_res_t next;<br />
};<br />
·scws 高频关键词统计集，简称＂词表集＂，这是 scws 中统计调用时返回用的结构，也是一个单链表结构。</p>
<p>typedef struct scws_topword *scws_top_t;<br />
struct scws_topword<br />
{<br />
char *word;<br />
float weight;<br />
short times;<br />
char attr[2];<br />
scws_top_t next;<br />
};</p>
<p>2. 函数说明<br />
·scws_t scws_new();<br />
描述：分配或初始化与scws系列操作的 scws_st 对象。该函数将自动分配、初始化、并返回新对象的指针。通过调用 scws_free() 来释放该对象。<br />
返回值：初始化的 scws_st * （即 scws_t） 句柄。如果无足够内存以分配新的对象，返回NULL。<br />
错误：在内存不足的情况下，返回NULL。<br />
·void scws_free(scws_t s);<br />
描述：释放由 scws_new() 返回的 scws 操作句柄及对象内容，同时也会释放已经加载的词典和规则。<br />
返回值：无<br />
错误：无<br />
·void scws_set_charset(scws_t s, const char *cs);<br />
描述：设定当前 scws 所使用的字符集，目前仅支持 gbk 和 utf-8 两种字符集。参数 cs 描述的是新指定的字符集。若无此调用则系统缺省使用gbk字符集，指定字符集时 cs 参数的大小写不敏感。<br />
返回值：无<br />
错误：若指定的字符集不存在，则会自动使用 gbk 字符集替代。<br />
·void scws_set_dict(scws_t s, const char *fpath, int mode);<br />
描述：设定当前 scws 操作所有的词典文件。参数 fpath 描述的是词典的文件·¯径，词典格式是 XDB 格式。<br />
参数 mode 有2种值，分别为宏定义的：SCWS_XDICT_XDB （这表示直接读取 xdb 文件）、SCWS_XDICT_MEM （这表示将 xdb 文件全部加载到内存中，以 XTree 结构存放）。具体用哪种方式需要根据自己的实际应用来决定。当使用本库做为 daemon server 时应当使用 mem 方式，当只是 embed 调用时应该使用 xdb 方式，将 xdb 文件加载进内存不仅占用了比较多的内存，而且也需要一定的时间（35万条数据约需要0.3~0.5秒左右）。<br />
若此前 scws 句柄已经加载过词典，则此调用会先释放已经加载的词典。<br />
返回值：无</p>
<p>错误： 如果加载失败，scws_t 结构中的 d 元素为 NULL，即通过  s-&gt;d == NULL 与否来判断加载失败或成功。</p>
<p>·void scws_set_rule(scws_t s, const char *fpath);<br />
描述：设定规则集文件。参数 fpath 是规则集文件的路径。若此前 scws 句柄已经加载过规则集，则此调用会先释放已经加载的规则集。规则集定义了一些新词自动识别规则，包括常见的人名、地区、数字年代等。规则编写方法另行参考其它部分。<br />
返回值：无<br />
错误：加载失败，scws_t 结构中的 r 元素为 NULL，即通过 s-&gt;r == NULL 与否来判断加载的失败与成功。</p>
<p>·void scws_set_ignore(scws_t s, int yes);<br />
描述：设定分词执行过程中是否忽略所有的标点等特殊符号（不会忽略\r和\n）。参数 yes 为 1 表示忽略，为0表示不忽略，缺省情况为不忽略。<br />
返回值：无<br />
错误：无</p>
<p>·void scws_set_multi(scws_t s, int mode);<br />
描述：设定分词执行时是否执行针对长词复合切分。（例如：中国人-&gt;中国+人+中国人）。参数 mode 表示复合分词法的级别，取值为 1 ~ 15。mode 设定值，1~15。1|2|4|8 依次表示 short|duality|zmain|zall。缺省不复合分词。<br />
返回值：无<br />
错误：无</p>
<p>·void scws_set_duality(scws_t s, int yes);<br />
描述：设定是否将闲散文字自动以二字分词法聚合，参数 yes 的值如果为 1 表示执行二分聚合，0 表示不处理，缺省为 0。<br />
返回值：无<br />
错误：无</p>
<p>·void scws_set_debug(scws_t s, int yes);<br />
描述：设定分词时对于疑难多路径综合分词时，是否打印出各条路径的情况。注意，打印使用的是 fprintf(stderr, &#8230; 故，这项功能不要随便使用，仅在命令行嵌入式调用时可以使用，参见例子中的 cmd.c 。当库函数编译选项中加入 -DLIBSCWS_QUIET 时此项不生效。（参见 php 扩展，PHP扩展里就是加入此项）<br />
返回值：无<br />
错误：无</p>
<p>·void scws_send_text(scws_t s, const char *text, int len);<br />
描述：设定要切分的文本数据，text 指定该串文本的起始位置，而 len 表示这段文本的长度。该函数可安全用于二进制数据，不会因为字符串中包括 \0 而停止切分。这个函数应该在 scws_get_result 和 scws_get_tops 之前调用。<br />
返回值：无<br />
错误：无。<br />
注：scws结构内部维护着该字符串的指针和相应的偏移及长度，故连续调用的话后者会覆盖前者的设定；不应在多次 scws_get_result 循环中调用 scws_send_text()。</p>
<p>·scws_res_t scws_get_result(scws_t s);<br />
描述：取回一系列分词结果集，该分词结果必须调用 scws_free_result() 释放，传入链表头指针。<br />
返回值：返回的是结果集链表的头部指针。该函数必须循环调用，当返回值为 NULL 时表示分词结束。<br />
错误：无</p>
<p>·void scws_free_result(scws_res_t result);<br />
描述：根据结果集的链表头释放结果集<br />
返回值：无<br />
错误：无</p>
<p>·scws_top_t scws_get_tops(scws_t s, int limit, char *xattr);<br />
描述：返回指定的关键词表统计集，系统会自动根据词语出现的次数及其 idf 值计算排名。参数 limit 指定取回数据的最大条数，若传入值为0或负数，则自动重设为10。参数 xattr 用来描述要排除或参与的统计词汇词性，多个词性之间用逗号隔开。当以~开头时表示统计结果中不包含这些词性，否则表示必须包含，传入 NULL 表示统计全部词性。<br />
返回值：返回词表集链表的头指针，该词表集必须调用 scws_free_tops 释放<br />
错误：无</p>
<p>·void scws_free_tops(scws_top_t tops);<br />
描述：根据词表集的链表头释放词表集<br />
返回值：无<br />
错误：无</p>
<p>3. 使用实例<br />
一个简单的分词实例：<br />
#include &lt;scws.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
main()<br />
{<br />
scws_t s;<br />
scws_res_t res, cur;<br />
char *text = &#8220;Hello, 我名字叫李那曲是一个中国人, 我有时买Q币来玩, 我还听说过C#语言&#8221;;</p>
<p>if (!(s = scws_new())) {<br />
printf(&#8220;error, can&#8217;t init the scws_t!\n&#8221;);<br />
exit(-1);<br />
}<br />
scws_set_charset(s, &#8220;gbk&#8221;);<br />
scws_set_dict(s, &#8220;/usr/local/scws/etc/dict_chs_gbk.xdb&#8221;, SCWS_XDICT_XDB);<br />
scws_set_rule(s, &#8220;/usr/local/scws/etc/rules.ini&#8221;);</p>
<p>scws_send_text(s, text, strlen(text));<br />
while (res = cur = scws_get_result(s))<br />
{<br />
while (cur != NULL)<br />
{<br />
printf(&#8220;Word: %.*s/%s (IDF = %4.2f)\n&#8221;, cur-&gt;len, text+cur-&gt;off, cur-&gt;attr, cur-&gt;idf);<br />
cur = cur-&gt;next;<br />
}<br />
scws_free_result(res);<br />
}</p>
<p>scws_free(s);<br />
}</p>
<p>编译：gcc -o test -I/usr/local/scws/include -L/usr/local/scws/lib test.c -lscws</p>
<p>&gt; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &lt;</p>
<p>[配套工具]</p>
<p>1. /usr/local/scws/bin/scws 或  $prefix/bin/scws</p>
<p>这是分词的命令行演示版本<br />
执行 scws -h 可以看到详细帮助：</p>
<p>Usage: scws [options] [input] [output]<br />
-i &lt;file|string&gt; input string or filepath<br />
(default: try to read from &lt;stdin&gt; everyline)<br />
-o &lt;file&gt;        output filepath (default to &lt;stdout&gt;)<br />
-c &lt;charset&gt;     set the charset (default: gbk)<br />
charset must been same with dictionary &amp; ruleset<br />
-r &lt;file&gt;        set the ruleset file (default: none)<br />
-d &lt;file&gt;        set the dictionary file (default: none)<br />
-M &lt;1~15&gt;        use multi child words mode(中国人-&gt;中国+人+中国人)<br />
1|2|4|8: short|duality|zmain|zall<br />
-I               ignore the all mark symbol such as ,:<br />
-A               show the word attribute<br />
-E               import the xdb dict into xtree(memory)<br />
-N               don&#8217;t show time usage and warnings<br />
-D               debug segment, see the segment detail<br />
-U               use duality algorithm for single chinese<br />
-t &lt;NUM&gt;         fetch the top words instead of segment<br />
-a [~]&lt;attr1,attr2,&#8230;&gt;   prefix by ~ means exclude them.<br />
For topwords, exclude or include some word attrs<br />
-v        Show the version.<br />
-h        Show this page for help.</p>
<p>-i &lt;&gt;: 要切分的字符串或者文件路径，如不指定则程序自动读取标准输入，每输入一次换行执行一次分词<br />
-o &lt;&gt;: 切分结果输出保存的文件路径，若不指定直接输出到屏幕<br />
-c &lt;&gt;: 指定分词的字符集，默认是 gbk<br />
-r &lt;&gt;: 指定规则集文件（规则集用于数词、数字、专有名字、人名的识别）<br />
-d &lt;&gt;: 指定词典文件路径（XDB格式，请在 -c 之后使用）<br />
-M &lt;&gt;: 复合分词的级别：1~15<br />
-I:    输出结果忽略跳过所有的标点符号<br />
-A:    显示分词属性<br />
-E:    将 xdb 词典读入内存 xtree 结构 (如果切分的文件很大才需要)<br />
-N:    不显示切分时间和提示<br />
-D:    debug 模式 (不必用, 需要编译时打开 &#8211;enable-developer)<br />
-U:    将闲散单字自动调用二分法结合<br />
-t &lt;&gt;: 取得高频词，参数为个数<br />
-a [~]&lt;attr1,..&gt; 只显示某些词性的词，加~表示过滤该词性的词<br />
-v:    查看版本<br />
-h:    查看帮助</p>
<p>2. /usr/local/scws/bin/gen_scws_dict 或 $prefix/bin/gen_scws_dict</p>
<p>这将文本的词典转换成 xdb 文件<br />
词典格式请参见源码 etc/ 中的 dict_chs_gbk.txt 和 dict_cht_gbk.txt<br />
每行一个词，各行由4个字段组成，字段之间用 \t 分隔，含义分别为：</p>
<p>&lt;词&gt;  &lt;词频(TF)&gt;  &lt;词重(IDF)&gt;  &lt;词性(北大标注)&gt;</p>
<p>&#8212;<br />
Usage: gen_scws_dict [options] [input file] [output file]<br />
-i        Specified the plain text dictionary(default: dict.txt).<br />
-o        Specified the output file path(default: dict.xdb)<br />
-c        Specified the input charset(default: gbk)<br />
-p        Specified the PRIME num for xdb<br />
-v        Show the version.<br />
-h        Show this page.</p>
<p>-c 指定字符集<br />
-i 文本文件(txt)<br />
-o 输出 xdb 文件的路径<br />
-p (指定XDB结果的质数，一般不需要）</p>
<p>&gt; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &lt;<br />
[PHP 扩展安装说明]</p>
<p>本软件包，在源码目录树中包含了 php 扩展的移植代码，可用于 php4<br />
或 php5 ，这里介绍它的安装方式，假设您已经将 scws-1.0.0 安装到<br />
/usr/local/scws 中或 $prefix 中。</p>
<p>安装此扩展要求您的 php 和系统环境安装了相应的 autoconf automake<br />
工具及 phpize</p>
<p>1. 进入源码目录的 phpext/ 目录<br />
2. 执行 phpize （在PHP安装目录的bin/目录下）<br />
3. 执行 ./configure &#8211;with-scws=/usr/local/scws &#8211;with-php-config=/usr/local/php/bin/php-config<br />
若 php 安装在特殊目录 $php_prefix, 则请在 configure 后加上<br />
&#8211;with-php-config=$php_prefix/bin/php-config</p>
<p>4. 执行 make 然后用 root 身份执行 make install</p>
<p>5. 在 php.ini 中加入以下几行</p>
<p>[scws]<br />
extension = scws.so<br />
scws.default.charset = gbk<br />
scws.default.fpath = $prefix/etc</p>
<p>6. 命令行下执行 php -m 就能看到 scws 了或者在 phpinfo() 中看看关于 scws 的部分</p>
<p>7. 这样就算安装完成了，余下的工作只是PHP代码编写问题了。关于 PHP 扩展的使用说明<br />
请参看代码中 phpext/php_scws_manual.txt 文件</p>
<p>&gt; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &lt;</p>
<p>6. 代码结构</p>
<p>scws-1.0.0/<br />
COPYING             &#8212; 版权说明<br />
README              &#8212; 相关全部文档，包括安装及使用，必读<br />
cli/                &#8212; 配套工具 scws-cli 及 词典制作工具<br />
scws_cmd.c<br />
gen_dict.c</p>
<p>libscws/            &#8212; 核心C代码<br />
*.h *.c</p>
<p>phpext/             &#8212; php扩展的代码<br />
etc/                &#8212; 文本词典及规则集文件<br />
rules.ini<br />
rules.utf8.ini    &#8212; utf8编码版的rules</p>
<p>dict_chs_gbk.txt  &#8212; gbk 编码的简体为主的文本词表<br />
dict_cht_gbk.txt  &#8212; gbk 编码的繁体为主的文本词表</p>
<p>&gt; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &lt;</p>
<p>7. rules.ini 规则集编写说明</p>
<p>（暂缺）</p>
<p>&gt; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &lt;<br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/'>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</a></li>
<li><a href='http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/'>memcache测试脚本</a></li>
<li><a href='http://www.pkphp.com/2011/04/07/centos-iftop/'>centOS带宽实时流量查看工具</a></li>
<li><a href='http://www.pkphp.com/2010/01/25/svn-report-svn-vcc-default/'>svn: REPORT 请求“/!svn/vcc/default”失败 解决办法</a></li>
<li><a href='http://www.pkphp.com/2010/01/25/linux-cp-force/'>Linux中cp总是提示覆盖文件的解决办法</a></li>
</ul>
<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="http://www.pkphp.com/" style="font-size: 13px;">http://www.pkphp.com/</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="rules.ini 规则集编写说明" style="font-size: 13px;">rules.ini 规则集编写说明</a>(2)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="scws.default.charset utf" style="font-size: 13px;">scws.default.charset utf</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="scws.so的位置" style="font-size: 13px;">scws.so的位置</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="dict_chs_gbk 规则" style="font-size: 13px;">dict_chs_gbk 规则</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="scws" style="font-size: 13px;">scws</a>(3)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="php 中文分词" style="font-size: 13px;">php 中文分词</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="scws 段错误" style="font-size: 13px;">scws 段错误</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="C# 读 取词语" style="font-size: 13px;">C# 读 取词语</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="中文分词 内存占用" style="font-size: 13px;">中文分词 内存占用</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="php中文分词" style="font-size: 13px;">php中文分词</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="php分词" style="font-size: 13px;">php分词</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="linux php5 scws" style="font-size: 13px;">linux php5 scws</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="中文分词 词库 助词 形容词 量词 下载" style="font-size: 13px;">中文分词 词库 助词 形容词 量词 下载</a>(1)<a href="http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/" title="支持中文分词的搜索引擎程序" style="font-size: 13px;">支持中文分词的搜索引擎程序</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F17%2F%25E8%25BD%25AC%25E5%25BC%2580%25E6%25BA%2590php%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E6%2589%25A9%25E5%25B1%2595phpcws-100%25E5%258F%2591%25E5%25B8%2583%25E5%2595%25A6%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fwordpress-seo-%25E4%25B8%25AD%25E6%2596%2587%25E6%258F%2592%25E4%25BB%25B6-v10%25E5%258F%2591%25E5%25B8%2583%25EF%25BC%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress SEO 中文插件 V1.0发布！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F29%2Fwordpress-seo-%25E4%25B8%25AD%25E6%2596%2587%25E6%258F%2592%25E4%25BB%25B6%25E8%25AE%25BE%25E8%25AE%25A1%25E7%25BB%2586%25E8%258A%2582%25E5%2585%25AC%25E5%25B8%2583%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress SEO 中文插件设计细节公布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F13%2Fwordpress-plugin-seo-chinese%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F06%2F12%2Fscws%25E7%25AE%2580%25E6%2598%2593%25E4%25B8%25AD%25E6%2596%2587%25E5%2588%2586%25E8%25AF%258D%25E7%25B3%25BB%25E7%25BB%259F%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【原创】WordPress中文SEO插件 V0.8发布!</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>memcache测试脚本</title>
		<link>http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/</link>
		<comments>http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 16:12:57 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[LAMP]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=19</guid>
		<description><![CDATA[&#60;?php //连接 $mem = new Memcache; $mem-&#62;connect(&#8220;127.0.0.1&#8220;, 11211); //保存数据 $mem-&#62;set(&#8216;key1&#8216;, &#8216;This is first value&#8216;, 0, 60); $val = $mem-&#62;get(&#8216;key1&#8216;); echo &#8220;Get key1 value: &#8220; . $val .&#8220;&#60;br&#62;&#8220;; //替换数据 $mem-&#62;replace(&#8216;key1&#8216;, &#8216;This is replace value&#8216;, 0, 60); $val = $mem-&#62;get(&#8216;key1&#8216;); echo &#8220;Get key1 value: &#8220; . $val . &#8220;&#60;br&#62;&#8220;; //保存数组 $arr = array(&#8216;aaa&#8216;, &#8216;bbb&#8216;, &#8216;ccc&#8216;, &#8216;ddd&#8216;); $mem-&#62;set(&#8216;key2&#8216;, [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F28%2F%25E5%25AE%2589%25E8%25A3%2585memcache-for-php%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F29%2Fmemcache%25E6%25B5%258B%25E8%25AF%2595%25E8%2584%259A%25E6%259C%25AC%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装memCache for PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F06%2Fwordpress%25E5%2590%25AF%25E7%2594%25A8memcache%25E8%25AF%25A6%25E8%25A7%25A3%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F29%2Fmemcache%25E6%25B5%258B%25E8%25AF%2595%25E8%2584%259A%25E6%259C%25AC%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress启用memcache详解</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F07%2F%25E6%2589%258B%25E6%259C%25BA%25E6%25B5%258B%25E8%25AF%2595%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F29%2Fmemcache%25E6%25B5%258B%25E8%25AF%2595%25E8%2584%259A%25E6%259C%25AC%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">手机测试</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F27%2Fwindows-live-writer-%25E6%25B5%258B%25E8%25AF%2595%25EF%25BC%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F29%2Fmemcache%25E6%25B5%258B%25E8%25AF%2595%25E8%2584%259A%25E6%259C%25AC%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">windows live writer 测试！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p><span style="color: #000000;">&lt;?</span><span style="color: #000000;">php<br />
</span><span style="color: #008000;">//</span><span style="color: #008000;">连接</span><span style="color: #008000;"><br />
</span><span style="color: #800080;">$mem</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">new</span><span style="color: #000000;"> Memcache;<br />
</span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">connect(</span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">127.0.0.1</span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">11211</span><span style="color: #000000;">);</span></p>
<p><span style="color: #008000;">//</span><span style="color: #008000;">保存数据</span><span style="color: #008000;"><br />
</span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">set(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">key1</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">This is first value</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">60</span><span style="color: #000000;">);<br />
</span><span style="color: #800080;">$val</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">get(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">key1</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">);<br />
</span><span style="color: #0000ff;">echo</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">Get key1 value: </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;"> </span><span style="color: #000000;">.</span><span style="color: #000000;"> </span><span style="color: #800080;">$val</span><span style="color: #000000;"> </span><span style="color: #000000;">.</span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">&lt;br&gt;</span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">;</span></p>
<p><span style="color: #008000;">//</span><span style="color: #008000;">替换数据</span><span style="color: #008000;"><br />
</span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">replace(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">key1</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">This is replace value</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">60</span><span style="color: #000000;">);<br />
</span><span style="color: #800080;">$val</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">get(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">key1</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">);<br />
</span><span style="color: #0000ff;">echo</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">Get key1 value: </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;"> </span><span style="color: #000000;">.</span><span style="color: #000000;"> </span><span style="color: #800080;">$val</span><span style="color: #000000;"> </span><span style="color: #000000;">.</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">&lt;br&gt;</span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">;</span></p>
<p><span style="color: #008000;">//</span><span style="color: #008000;">保存数组</span><span style="color: #008000;"><br />
</span><span style="color: #800080;">$arr</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">array</span><span style="color: #000000;">(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">aaa</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">bbb</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">ccc</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">ddd</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">);<br />
</span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">set(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">key2</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #800080;">$arr</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">,</span><span style="color: #000000;"> </span><span style="color: #000000;">60</span><span style="color: #000000;">);<br />
</span><span style="color: #800080;">$val2</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">get(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">key2</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">);<br />
</span><span style="color: #0000ff;">echo</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">Get key2 value: </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">;<br />
</span><span style="color: #008080;">print_r</span><span style="color: #000000;">(</span><span style="color: #800080;">$val2</span><span style="color: #000000;">);<br />
</span><span style="color: #0000ff;">echo</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">&lt;br&gt;</span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">;</span></p>
<p><span style="color: #008000;">//</span><span style="color: #008000;">删除数据</span><span style="color: #008000;"><br />
</span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">delete(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">key1</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">);<br />
</span><span style="color: #800080;">$val</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">get(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">key1</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">);<br />
</span><span style="color: #0000ff;">echo</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">Get key1 value: </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;"> </span><span style="color: #000000;">.</span><span style="color: #000000;"> </span><span style="color: #800080;">$val</span><span style="color: #000000;"> </span><span style="color: #000000;">.</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">&lt;br&gt;</span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">;</span></p>
<p><span style="color: #008000;">//</span><span style="color: #008000;">清除所有数据</span><span style="color: #008000;"><br />
</span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #008080;">flush</span><span style="color: #000000;">();<br />
</span><span style="color: #800080;">$val2</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">get(</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">key2</span><span style="color: #000000;">&#8216;</span><span style="color: #000000;">);<br />
</span><span style="color: #0000ff;">echo</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">Get key2 value: </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">;<br />
</span><span style="color: #008080;">print_r</span><span style="color: #000000;">(</span><span style="color: #800080;">$val2</span><span style="color: #000000;">);<br />
</span><span style="color: #0000ff;">echo</span><span style="color: #000000;"> </span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">&lt;br&gt;</span><span style="color: #000000;">&#8220;</span><span style="color: #000000;">;</span></p>
<p><span style="color: #008000;">//</span><span style="color: #008000;">关闭连接</span><span style="color: #008000;"><br />
</span><span style="color: #800080;">$mem</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">close();<br />
</span><span style="color: #000000;">?&gt;</span></p>
<p>如果正常的话，浏览器将输出：<br />
<span style="color: #993300;">Get key1 value: This is first value<br />
Get key1 value: This is replace value<br />
Get key2 value: Array ( [0] =&gt; aaa [1] =&gt; bbb [2] =&gt; ccc [3] =&gt; ddd )<br />
Get key1 value:<br />
Get key2 value:</span><br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2009/02/17/%e8%bd%ac%e5%bc%80%e6%ba%90php%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e6%89%a9%e5%b1%95phpcws-100%e5%8f%91%e5%b8%83%e5%95%a6/'>[转]开源PHP中文分词扩展:PHPCWS 1.0.0发布啦</a></li>
<li><a href='http://www.pkphp.com/2008/06/12/scws%e7%ae%80%e6%98%93%e4%b8%ad%e6%96%87%e5%88%86%e8%af%8d%e7%b3%bb%e7%bb%9f/'>SCWS简易中文分词系统</a></li>
<li><a href='http://www.pkphp.com/2011/04/07/centos-iftop/'>centOS带宽实时流量查看工具</a></li>
<li><a href='http://www.pkphp.com/2010/01/25/svn-report-svn-vcc-default/'>svn: REPORT 请求“/!svn/vcc/default”失败 解决办法</a></li>
<li><a href='http://www.pkphp.com/2010/01/25/linux-cp-force/'>Linux中cp总是提示覆盖文件的解决办法</a></li>
</ul>
<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="memcache 测试" style="font-size: 13px;">memcache 测试</a>(8)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="memcached php 测试脚本" style="font-size: 13px;">memcached php 测试脚本</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="memcached illegal character" style="font-size: 13px;">memcached illegal character</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="php memcached 测试" style="font-size: 13px;">php memcached 测试</a>(2)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="memcache 测试脚本" style="font-size: 13px;">memcache 测试脚本</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="value" style="font-size: 13px;">value</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="memcached 测试 php" style="font-size: 13px;">memcached 测试 php</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="测试memcache最大连接" style="font-size: 13px;">测试memcache最大连接</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="memcached 测试脚本" style="font-size: 13px;">memcached 测试脚本</a>(2)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="php memcache测试" style="font-size: 13px;">php memcache测试</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="memcache测试" style="font-size: 13px;">memcache测试</a>(3)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="memcache 管理脚本" style="font-size: 13px;">memcache 管理脚本</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="測試 memcached" style="font-size: 13px;">測試 memcached</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="memcahce 测试" style="font-size: 13px;">memcahce 测试</a>(1)<a href="http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/" title="php memcache 管理脚本" style="font-size: 13px;">php memcache 管理脚本</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F28%2F%25E5%25AE%2589%25E8%25A3%2585memcache-for-php%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F29%2Fmemcache%25E6%25B5%258B%25E8%25AF%2595%25E8%2584%259A%25E6%259C%25AC%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装memCache for PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2009%2F02%2F06%2Fwordpress%25E5%2590%25AF%25E7%2594%25A8memcache%25E8%25AF%25A6%25E8%25A7%25A3%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F29%2Fmemcache%25E6%25B5%258B%25E8%25AF%2595%25E8%2584%259A%25E6%259C%25AC%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress启用memcache详解</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F09%2F07%2F%25E6%2589%258B%25E6%259C%25BA%25E6%25B5%258B%25E8%25AF%2595%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F29%2Fmemcache%25E6%25B5%258B%25E8%25AF%2595%25E8%2584%259A%25E6%259C%25AC%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">手机测试</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F27%2Fwindows-live-writer-%25E6%25B5%258B%25E8%25AF%2595%25EF%25BC%2581%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F03%2F29%2Fmemcache%25E6%25B5%258B%25E8%25AF%2595%25E8%2584%259A%25E6%259C%25AC%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">windows live writer 测试！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/03/29/memcache%e6%b5%8b%e8%af%95%e8%84%9a%e6%9c%ac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

