<?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>PHPMan--Live and learn &#187; PHP</title>
	<atom:link href="http://www.phpman.com.cn/archives/category/coding/php-web-develop/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phpman.com.cn</link>
	<description>不积跬步,无以至千里;不积小流,无以成江海</description>
	<lastBuildDate>Wed, 28 Jul 2010 02:39:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>php模块动态编译</title>
		<link>http://www.phpman.com.cn/archives/323</link>
		<comments>http://www.phpman.com.cn/archives/323#comments</comments>
		<pubDate>Sat, 09 Jan 2010 11:17:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=323</guid>
		<description><![CDATA[今天编译memcache扩展，由于从别的机器拷过来的，忘记make clean，出了点插曲，备忘下
cd memcache-2.2.5
/usr/local/bin/phpize
make clean
./configure &#8211;enable-memcache &#8211;with-php-config=/usr/local/bin/php-config &#8211;with-zlib-dir
make
make install
编译后会生成memcache.so
例如我的是：
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/
修改php.ini
将extension_dir改为以上目录或将生成的so文件移至extension目录
添加行
extension=memcache.so
]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/323/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>该死的DOMDocument!</title>
		<link>http://www.phpman.com.cn/archives/275</link>
		<comments>http://www.phpman.com.cn/archives/275#comments</comments>
		<pubDate>Thu, 24 Sep 2009 06:37:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[DOM]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=275</guid>
		<description><![CDATA[PHP处理XML类文档主要有两个模块，一般简单点用SimpleXML,不过他只能作遍历、取值、取属性等操作，而不能进行删除修改节点的操作。使用libxml的DOMDocument功能比较强大，不过也比较麻烦。今天就遇见一问题，折腾很久～
有XML格式如下:

&#60;foo xmlns=&#34;test&#34;&#62;
&#60;bar attr='a'&#62;&#60;/bar&#62;
&#60;bar attr='b'&#62;&#60;/bar&#62;
&#60;bar attr='c'&#62;&#60;/bar&#62;
&#60;/foo&#62;

开始尝试解析

&#60;?php
    $dom = new DOMDocument;
    $dom-&#62;loadXML&#40;$xmls&#41;;//xmls变量为以上XML的字符串内容
    $messages = $dom-&#62;getElementsByTagName&#40;'bar'&#41;;
    foreach&#40;$messages as $k=&#62;$message&#41;&#123;
        if&#40;!is_object&#40;$message&#41; &#124;&#124; &#40;$message-&#62;getAttribute&#40;'attr'&#41; == 'a'&#41;&#41;&#123;
            continue;//属性attr 为a的保留   [...]]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/275/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>将linux文件同步至windows下实现自动备份</title>
		<link>http://www.phpman.com.cn/archives/245</link>
		<comments>http://www.phpman.com.cn/archives/245#comments</comments>
		<pubDate>Tue, 23 Jun 2009 12:47:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[system related]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=245</guid>
		<description><![CDATA[对站长来说，丢失数据又没得恢复绝对是恶梦……因此，想到将linux下的数据库和www目录自动备份，因为有win主机闲置，那就存它那了。闲话少说，现在开工:
首先给win主机安装cwrsync(基于cgwin和rsync的同步软件)
…………]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/245/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>memcache实践小记</title>
		<link>http://www.phpman.com.cn/archives/243</link>
		<comments>http://www.phpman.com.cn/archives/243#comments</comments>
		<pubDate>Tue, 23 Jun 2009 11:06:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[system related]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=243</guid>
		<description><![CDATA[memcache是一个高效快速的,以内存存取的高速缓存，其保存方式通过“键”＝&#62;“值”的方式，对key进行hash存储，因而查询速度快，避免硬盘的反复擦写,也正如此，断电或重启就得重新为它“灌”内容了。
准备工作:
1.先安装libevent,因为memcached是依赖它的
2.memcached下载与安装
# ./memcached -d -m 50 -p 11211 -u root
参数说明 -m 指定使用多少兆的缓存空间；-p 指定要监听的端口； -u 指定以哪个用户来运行
3.启动./memcached -p 11211 如果报如下错
error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
那么,注册一下libevent扩展
# vi /etc/ld.so.conf.d/libevent-i386.conf
内容为你编译生成的libevent库的路径，默认为/usr/local/lib
运行
# ldconfig
好了，这样memcachd就装好了，接下来安装php支持,可以通过phpize或静态编译方式 ，我是通过后者
下载最新版pecl memcache包解压至phpdir/ext
#rm configure
#buildconf &#8211;force 当然这个需要
#./configure &#8211;with-memcache &#8211;enable-memcache
需要注意: 要运行“buildconf”脚本，需要 autoconf ，如果没有或版 本过低就先升级它
OK,写几行试试～

&#60;?php
set_time_limit&#40;1000&#41;;
$host = 'localhost';
$memcache = new Memcache;
$memcache-&#62;connect&#40;$host,11211&#41;;
&#160;
for&#40;$i=0;$i&#60;100000;$i++&#41;&#123;
/*存上10w个看看*/
    $memcache-&#62;set&#40;'k'.$i,$i,false,1000&#41;;
&#125;
&#160;
print_r&#40;$memcache-&#62;getServerStatus&#40;$host&#41;&#41;;
print_r&#40;$memcache-&#62;getStats&#40;&#41;&#41;;//查看memcached服务状态
?&#62;

]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/243/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fsockopen中用feof判断读取http响应内容</title>
		<link>http://www.phpman.com.cn/archives/208</link>
		<comments>http://www.phpman.com.cn/archives/208#comments</comments>
		<pubDate>Sun, 31 May 2009 08:37:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=208</guid>
		<description><![CDATA[我们通常使用fsockopen打开一个$fp来发送http头，请求后用feof判断是否读完来获取服务器响应的内容。
但是这使用feof时要特别注意一点,php手册上关于feof有这样一个说明:
Warning
如果服务器没有关闭由 fsockopen() 所打开的连接，feof() 会一直等待直到超时而返回 TRUE。默认的超时限制是 60 秒，可以使用 stream_set_timeout() 来改变这个值。
也就是一个打开的socket连接，没有在读完后关闭，feof会一直返回true直到超时
看如下代码:

$url = &#34;/N_StockQuote.aspx?StockCode=002024&#38;amp;StockMarket=2&#34;;
$fp = fsockopen&#40;'hqdigi.eastmoney.com',80,$errno,$errstr,10&#41;;
if&#40;!$fp&#41;&#123;
 die&#40;&#34;Network error or invalid stock code\r\n&#34;&#41;;
&#125;elseif&#40;$error&#41;&#123;
 die&#40;&#34;$error:$errstr\r\n&#34;&#41;;
&#125;else&#123;
 $request = &#34;GET $url HTTP/1.1\r\n&#34;;
 $request .= &#34;Host: hqdigi.eastmoney.com\r\n&#34;;
 $request .= &#34;Pragma: no-cache\r\n&#34;;
 $request .= &#34;Cache-Control: no-cache\r\n\r\n&#34;;
 fwrite&#40;$fp,$request&#41;;//发送请求头
 while&#40;!feof&#40;$fp&#41;&#41;&#123;
  $tmp .= fgets&#40;$fp,1024&#41;;//获取服务器返回信息
 &#125;
&#125;

运行这代码就有问题了,while进入死循环，直到超时
因此，稍作改动，请求头部最后加上Connection:close,来告诉服务器,响应完就断开
]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/208/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP与Mysql函数对照整理</title>
		<link>http://www.phpman.com.cn/archives/147</link>
		<comments>http://www.phpman.com.cn/archives/147#comments</comments>
		<pubDate>Wed, 20 May 2009 08:03:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=147</guid>
		<description><![CDATA[平时对MYSQL函数使用较少，想使用时确不记得函数名及参数用法。
现对比PHP整理下，便于记忆……
本页将不断更新，直至完善]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/147/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php的$HTTP_RAW_POST_DATA</title>
		<link>http://www.phpman.com.cn/archives/143</link>
		<comments>http://www.phpman.com.cn/archives/143#comments</comments>
		<pubDate>Mon, 11 May 2009 09:25:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[HTTP_RAW_POST_DATA]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=143</guid>
		<description><![CDATA[今天一同事问我，他用了Content-Type=text/xml型，提交了一个xml文档内容给了php server,要怎么获得这个POST数据。
这把我愣住了，以前确实没写过这样的POST，赶紧查手册，发现有$HTTP_RAW_POST_DATA 这一项。对此的解释是：The RAW / uninterpreted HTTP POST information can be accessed with:   $GLOBALS['HTTP_RAW_POST_DATA'] This is useful in cases where the post Content-Type is not something PHP understands (such as text/xml).
意思是，由于PHP默认只识别application/x-www.form-urlencoded标准的数据类型，因此，对型如text/xml的内容无法解析为$_POST数组，故保留原型，交给$HTTP_RAW_POST_DAT来接收。
]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/143/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>获取用户IP地址的几个属性的区别</title>
		<link>http://www.phpman.com.cn/archives/90</link>
		<comments>http://www.phpman.com.cn/archives/90#comments</comments>
		<pubDate>Wed, 08 Apr 2009 03:28:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=90</guid>
		<description><![CDATA[获取用户IP地址的几个属性的区别(HTTP_X_FORWARDED_FOR,HTTP_X_FORWARDED,HTTP_VIA,REMOTE_ADDR)]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/90/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>全排列算法</title>
		<link>http://www.phpman.com.cn/archives/84</link>
		<comments>http://www.phpman.com.cn/archives/84#comments</comments>
		<pubDate>Wed, 01 Apr 2009 11:53:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=84</guid>
		<description><![CDATA[全排列算法实现]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/84/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UTF-8中文截取函数(转)</title>
		<link>http://www.phpman.com.cn/archives/23</link>
		<comments>http://www.phpman.com.cn/archives/23#comments</comments>
		<pubDate>Wed, 11 Feb 2009 05:43:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[编程相关]]></category>

		<guid isPermaLink="false">http://www.phpman.com.cn/?p=23</guid>
		<description><![CDATA[UTF-8中文截取函数]]></description>
		<wfw:commentRss>http://www.phpman.com.cn/archives/23/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
