<?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>曾华水的博客 &#187; PHP</title>
	<atom:link href="http://www.mrzeng.com/topics/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mrzeng.com</link>
	<description>NO.1 or Nothing</description>
	<lastBuildDate>Wed, 07 Sep 2011 12:47:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>常用的PHP系统在nginx下的伪静态规则</title>
		<link>http://www.mrzeng.com/post/nginx-rewrite-in-common-systems.html</link>
		<comments>http://www.mrzeng.com/post/nginx-rewrite-in-common-systems.html#comments</comments>
		<pubDate>Thu, 25 Feb 2010 08:17:15 +0000</pubDate>
		<dc:creator>zenghuashui</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Nginx]]></category>

		<guid isPermaLink="false">http://www.mrzeng.com/?p=149</guid>
		<description><![CDATA[常用的系统在nginx下的伪静态规则。 CMS系统 PHPCMS： location / { ###以下为PHPCMS 伪静态化rewrite规则 rewrite ^(.*)show-([0-9]+)-([0-9]+).html$ $1/show.php?itemid=$2&#038;page=$3; rewrite ^(.*)list-([0-9]+)-([0-9]+).html$ $1/list.php?catid=$2&#038;page=$3; rewrite ^(.*)show-([0-9]+).html$ $1/show.php?specialid=$2; } 商城shopex location / { if (!-e $request_filename) { rewrite ^/(.+.(html&#124;xml&#124;json&#124;htm&#124;php&#124;jsp&#124;asp&#124;shtml))$ /index.php?$1 last; } } ECSHOP if (!-e $request_filename) { rewrite “^/index.html” /index.php last; rewrite “^/category$” /index.php last; rewrite “^/feed-c([0-9]+).xml$” /feed.php?cat=$1 last; rewrite “^/feed-b([0-9]+).xml$” /feed.php?brand=$1 last; rewrite “^/feed.xml$” [...]]]></description>
			<content:encoded><![CDATA[<p>常用的系统在nginx下的伪静态规则。</p>
<p><span id="more-149"></span><br />
<strong>CMS系统</strong></p>
<p>PHPCMS： </p>
<pre class=prettyprint>location / {
###以下为PHPCMS 伪静态化rewrite规则
rewrite ^(.*)show-([0-9]+)-([0-9]+).html$ $1/show.php?itemid=$2&#038;page=$3;
rewrite ^(.*)list-([0-9]+)-([0-9]+).html$ $1/list.php?catid=$2&#038;page=$3;
rewrite ^(.*)show-([0-9]+).html$ $1/show.php?specialid=$2;
} </pre>
<p><strong>商城</strong>shopex</p>
<pre class=prettyprint>

location / {
if (!-e $request_filename) {
rewrite ^/(.+.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 last;
}
}
</pre>
<p>ECSHOP</p>
<pre class=prettyprint>
if (!-e $request_filename)
{
rewrite “^/index.html” /index.php last;
rewrite “^/category$” /index.php last;
rewrite “^/feed-c([0-9]+).xml$” /feed.php?cat=$1 last;
rewrite “^/feed-b([0-9]+).xml$” /feed.php?brand=$1 last;
rewrite “^/feed.xml$” /feed.php last;
rewrite “^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$” /category.php?id=$1&#038;brand=$2&#038;price_min=$3&#038;price_max=$4&#038;filter_attr=$5&#038;page=$6&#038;sort=$7&#038;order=$8 last;
rewrite “^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*).html$” /category.php?id=$1&#038;brand=$2&#038;price_min=$3&#038;price_max=$4&#038;filter_attr=$5 last;
rewrite “^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$” /category.php?id=$1&#038;brand=$2&#038;page=$3&#038;sort=$4&#038;order=$5 last;
rewrite “^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*).html$” /category.php?id=$1&#038;brand=$2&#038;page=$3 last;
rewrite “^/category-([0-9]+)-b([0-9]+)(.*).html$” /category.php?id=$1&#038;brand=$2 last;
rewrite “^/category-([0-9]+)(.*).html$” /category.php?id=$1 last;
rewrite “^/goods-([0-9]+)(.*).html” /goods.php?id=$1 last;
rewrite “^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$” /article_cat.php?id=$1&#038;page=$2&#038;sort=$3&#038;order=$4 last;
rewrite “^/article_cat-([0-9]+)-([0-9]+)(.*).html$” /article_cat.php?id=$1&#038;page=$2 last;
rewrite “^/article_cat-([0-9]+)(.*).html$” /article_cat.php?id=$1 last;
rewrite “^/article-([0-9]+)(.*).html$” /article.php?id=$1 last;
rewrite “^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+).html” /brand.php?id=$1&#038;cat=$2&#038;page=$3&#038;sort=$4&#038;order=$5 last;
rewrite “^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*).html” /brand.php?id=$1&#038;cat=$2&#038;page=$3 last;
rewrite “^/brand-([0-9]+)-c([0-9]+)(.*).html” /brand.php?id=$1&#038;cat=$2 last;
rewrite “^/brand-([0-9]+)(.*).html” /brand.php?id=$1 last;
rewrite “^/tag-(.*).html” /search.php?keywords=$1 last;
rewrite “^/snatch-([0-9]+).html$” /snatch.php?id=$1 last;
rewrite “^/group_buy-([0-9]+).html$” /group_buy.php?act=view&#038;id=$1 last;
rewrite “^/auction-([0-9]+).html$” /auction.php?act=view&#038;id=$1 last;
rewrite “^/exchange-id([0-9]+)(.*).html$” /exchange.php?id=$1&#038;act=view last;
rewrite “^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$” /exchange.php?cat_id=$1&#038;integral_min=$2&#038;integral_max=$3&#038;page=$4&#038;sort=$5&#038;order=$6 last;
rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$” /exchange.php?cat_id=$1&#038;page=$2&#038;sort=$3&#038;order=$4 last;
rewrite “^/exchange-([0-9]+)-([0-9]+)(.*).html$” /exchange.php?cat_id=$1&#038;page=$2 last;
rewrite “^/exchange-([0-9]+)(.*).html$” /exchange.php?cat_id=$1 last;
} 
</pre>
<p>MVMMall</p>
<pre class=prettyprint>
	rewrite ^/brand-view-([0-9]+).html$ /;
	rewrite ^/brand-view-([0-9]+)-([0-9]+).html$ /;
	rewrite ^/auction-view-([0-9]+).html$ /;
	rewrite ^/group-view-([0-9]+).html$ /;
	rewrite ^/article-(.*)-([0-9]+).html$ /;
	rewrite ^/([a-z]+)-(.*)-([0-9]+).html$ /;
	rewrite ^/index.html$ /;
	rewrite ^/sitemap.html$ /;
	rewrite ^/lackcheck.html$ /;
	rewrite ^/search.html$ /;
	rewrite ^/search.html$ /;
	rewrite ^/register.html$ /;
</pre>
<p><strong>博客</strong><br />
WordPress</p>
<pre class=prettyprint>
location / {
index index.html index.php;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
</pre>
<p><strong>论坛</strong><br />
PHPwind</p>
<pre class=prettyprint>
location / {
####以下为PHPWind 伪静态化rewrite规则
rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2 last;
}
</pre>
<p>discuz</p>
<pre class=prettyprint>
rewrite ^/archiver/((fid|tid)-[w-]+.html)$ /archiver/index.php?$1 last;
rewrite ^/forum-([0-9]+)-([0-9]+).html$ /forumdisplay.php?fid=$1&#038;page=$2 last;
rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ /viewthread.php?tid=$1&#038;extra=page%3D$3&#038;page=$2 last;
rewrite ^/tag-(.+).html$ /tag.php?name=$1 last;
</pre>
<h3  class="related_post_title">相关日志</h3><ul class="related_post"><li><a href="http://www.mrzeng.com/post/windows-nginx-php.html" title="在windows上安装nginx+php环境">在windows上安装nginx+php环境</a><br /><small>目前，nginx以其独特的性能越来越博得喜爱，LNMP环境逐步代替了LAMP环境。Nginx从v0.7.52也开始支持windows环境。接下来简要介绍些安装方法。

1、准备好安装软件
    Nginx ：我们选用最新的稳定版本0.7.65。http://nginx.org/download/nginx-0.7.65.zip
      PHP:http://www.php.net/g...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.mrzeng.com/post/nginx-rewrite-in-common-systems.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP获取客户端IP的几种方法</title>
		<link>http://www.mrzeng.com/post/php-get-client-ip.html</link>
		<comments>http://www.mrzeng.com/post/php-get-client-ip.html#comments</comments>
		<pubDate>Mon, 08 Feb 2010 05:38:32 +0000</pubDate>
		<dc:creator>zenghuashui</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[IP]]></category>

		<guid isPermaLink="false">http://www.mrzeng.com/?p=185</guid>
		<description><![CDATA[PHP获取客户端IP有几个函数，下面介绍下三种常用的写法。 第一种： &#60; ?php function GetIP() { //获取IP if ($_SERVER["HTTP_X_FORWARDED_FOR"]) $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; else if ($_SERVER["HTTP_CLIENT_IP"]) $ip = $_SERVER["HTTP_CLIENT_IP"]; else if ($_SERVER["REMOTE_ADDR"]) $ip = $_SERVER["REMOTE_ADDR"]; else if (getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else if (getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR"); else $ip = "Unknown"; return $ip; } ?&#62; 第二种： function getip() { [...]]]></description>
			<content:encoded><![CDATA[<p>PHP获取客户端IP有几个函数，下面介绍下三种常用的写法。<br />
<span id="more-185"></span><br />
第一种：</p>
<pre class=prettyprint>
&lt; ?php
function GetIP() { //获取IP
    if ($_SERVER["HTTP_X_FORWARDED_FOR"])
        $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
    else if ($_SERVER["HTTP_CLIENT_IP"])
        $ip = $_SERVER["HTTP_CLIENT_IP"];
    else if ($_SERVER["REMOTE_ADDR"])
        $ip = $_SERVER["REMOTE_ADDR"];
    else if (getenv("HTTP_X_FORWARDED_FOR"))
        $ip = getenv("HTTP_X_FORWARDED_FOR");
    else if (getenv("HTTP_CLIENT_IP"))
        $ip = getenv("HTTP_CLIENT_IP");
    else if (getenv("REMOTE_ADDR"))
        $ip = getenv("REMOTE_ADDR");
    else
        $ip = "Unknown";
    return $ip;
}
?&gt; 
</pre>
<p>第二种：</p>
<pre class=prettyprint>
function getip() {
 if (isset($_SERVER)) {
  if (isset($_SERVER[HTTP_X_FORWARDED_FOR])) {
   $realip = $_SERVER[HTTP_X_FORWARDED_FOR];
  } elseif (isset($_SERVER[HTTP_CLIENT_IP])) {
   $realip = $_SERVER[HTTP_CLIENT_IP];
  } else {
   $realip = $_SERVER[REMOTE_ADDR];
  }
 } else {
  if (getenv("HTTP_X_FORWARDED_FOR")) {
   $realip = getenv( "HTTP_X_FORWARDED_FOR");
  } elseif (getenv("HTTP_CLIENT_IP")) {
   $realip = getenv("HTTP_CLIENT_IP");
  } else {
   $realip = getenv("REMOTE_ADDR");
  }
 }
 $iphide=explode(".",$realip);
 $realip="$iphide[0].$iphide[1].$iphide[2].xxx";
 return $realip;
}
</pre>
<p>第三中</p>
<pre class=prettyprint>
function iptype1 () {
if (getenv("HTTP_CLIENT_IP")) {
   return getenv("HTTP_CLIENT_IP");
}
else {
   return "none";
}
}
function iptype2 () {
if (getenv("HTTP_X_FORWARDED_FOR")) {
   return getenv("HTTP_X_FORWARDED_FOR");
}
else {
   return "none";
}
}
function iptype3 () {
if (getenv("REMOTE_ADDR")) {
   return getenv("REMOTE_ADDR");
}
else {
   return "none";
}
}
function ip() {
$ip1 = iptype1();
$ip2 = iptype2();
$ip3 = iptype3();
if (isset($ip1) &#038;&#038; $ip1 != "none" &#038;&#038; $ip1 != "unknown") {
   return $ip1;
}
elseif (isset($ip2) &#038;&#038; $ip2 != "none" &#038;&#038; $ip2 != "unknown") {
   return $ip2;
}
elseif (isset($ip3) &#038;&#038; $ip3 != "none" &#038;&#038; $ip3 != "unknown") {
   return $ip3;
}
  else {
  return "none"; 
</pre>
<h3  class="related_post_title">相关日志</h3><ul class="related_post"><li><a href="http://www.mrzeng.com/post/linux-change-ip-solution.html" title="Linux中修改ip的办法">Linux中修改ip的办法</a><br /><small>切换到root账户下

切换到/etc/sysconfig/network-scripts/目录下；

编辑网卡编码：vi ifcfg-ethX X为第X-1个网卡。

DEVICE=ethX                                        设备名称
ONBOOT=yes                                        计算...</small></li><li><a href="http://www.mrzeng.com/post/vista-localhost-ip.html" title="Vista中无法使用localhost访问本机的解决方法">Vista中无法使用localhost访问本机的解决方法</a><br /><small>最近，买了个笔记本，装的是vista，奇怪的是，装上服务器套件后，死活不能用localhost访问，但127.0.0.1可以。搜索了一下，解决办法如下：

找到WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS 文件。HOSTS是文件名，这个文件没有扩展名。

用记事本打开它，发现多了一个

::1             localhost

删了它，保存。问题...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.mrzeng.com/post/php-get-client-ip.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用PHPRpc实现Java和PHP通信</title>
		<link>http://www.mrzeng.com/post/phprpc-java-php.html</link>
		<comments>http://www.mrzeng.com/post/phprpc-java-php.html#comments</comments>
		<pubDate>Sun, 07 Feb 2010 05:07:58 +0000</pubDate>
		<dc:creator>zenghuashui</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[jqGrid]]></category>

		<guid isPermaLink="false">http://www.mrzeng.com/?p=173</guid>
		<description><![CDATA[PHPRPC是一款不错的是轻型的、安全的、跨网际的、跨语言的、跨平台的、跨环境的、跨域的、支持复杂对象传输的、支持引用参数传递的、支持内容输出重定向的、支持分级错误处理的、支持会话的、面向服务的高性能远程过程调用协议。官方网址为http://www.phprpc.org/zh_CN/ 本文以Java作为服务器端，PHP作为客户端来作为演示。 1、先书写Java服务器端，书写一个接口。如下： package org.huashui.server; public interface UserManager { //增加一个用户名 public void add(String name); //获取用户名 public String getName(); //长数据测试 public String getLongString(); //长数据测试2 public byte[] getLongByte(); } 书写实现类 package org.huashui.server.impl; import org.huashui.server.UserManager; public class UserManagerImpl implements UserManager { private String name; public void add(String name) { this.name = name; System.out.println("我爱你," + name); } public String [...]]]></description>
			<content:encoded><![CDATA[<p>PHPRPC是一款不错的是轻型的、安全的、跨网际的、跨语言的、跨平台的、跨环境的、跨域的、支持复杂对象传输的、支持引用参数传递的、支持内容输出重定向的、支持分级错误处理的、支持会话的、面向服务的高性能远程过程调用协议。官方网址为<a href="http://">http://www.phprpc.org/zh_CN/</a></p>
<p>本文以Java作为服务器端，PHP作为客户端来作为演示。<br />
<span id="more-173"></span><br />
1、先书写Java服务器端，书写一个接口。如下：</p>
<pre class=prettyprint>
package org.huashui.server;

public interface UserManager {
	//增加一个用户名
	public void add(String name);
	//获取用户名
	public String getName();
	//长数据测试
	public String getLongString();
	//长数据测试2
	public byte[] getLongByte();

}
</pre>
<p>书写实现类</p>
<pre class=prettyprint>
package org.huashui.server.impl;

import org.huashui.server.UserManager;

public class UserManagerImpl implements UserManager {

	private String name;

	public void add(String name) {
		this.name = name;
		System.out.println("我爱你," + name);

	}

	public String getName() {

		return "我也爱你";
	}

	public String getLongString() {
		StringBuffer sb = new StringBuffer();

		return sb.toString();
	}

	public byte[] getLongByte() {
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i &lt; 40000; i++) {
			sb
					.append(
							i
									+ "insert into passport_members(username, password, email, regdate, salt, totalpoint, pid) values ('huashui','12312312312312','123@yahoo.com.cn','0','','0','123');")
					.append("n");
		}
		return sb.toString().getBytes();

	}

}
</pre>
<p>书写供远程调用的server.jsp<br />
</code>
<pre class=prettyprint>
&lt; %@ page language="java"  pageEncoding="ISO-8859-1"%&gt;

&lt; %@ page import="org.phprpc.PHPRPC_Server"%&gt;
&lt; %@ page import="org.huashui.server.UserManager"%&gt;

&lt; %@page import="org.huashui.server.impl.UserManagerImpl;"%&gt;

&lt; %

PHPRPC_Server phprpc_server = new PHPRPC_Server();
UserManager um;

um= new UserManagerImpl();
phprpc_server.add(um);
phprpc_server.start(request,response);
%&gt;
</pre>
<p>至此，服务器端完成。<br />
客户端</p>
<pre class=prettyprint>
header("Content-type:text/plain;charset=GB2312");
include ("php/phprpc_client.php");
$client = new PHPRPC_Client();
$client-&gt;useService('http://localhost:8080/phprpc/server.jsp");
$client-&gt;setCharset('GB2312');
$client-&gt;setKeyLength(128);
$client-&gt;setEncryptMode(3);
$client-&gt;add("huashui");
</pre>
<h3  class="related_post_title">相关日志</h3><ul class="related_post"><li><a href="http://www.mrzeng.com/post/jqgrid-formater-2.html" title="jqGrid进阶教程：3、jqGrid的数据格式化二">jqGrid进阶教程：3、jqGrid的数据格式化二</a><br /><small>jqGrid是非常强大的，除了上一讲提到的预置的格式化外，还提供自定义的格式化方法，这种方法也是我比较喜欢的方法。
我们接上面的例子


$("#grid_id").jqGrid({
...
   colModel : [ {name:'sex', edittype:'select', editoptions:{value:"1:男;2:女"}} ... ],
...
});
...</small></li><li><a href="http://www.mrzeng.com/post/jqgrid-example-download.html" title="jqGrid例子文件下载">jqGrid例子文件下载</a><br /><small>最近慵懒了很多，很少来上面博一博，发下jqGrid的例子的全部文件。
jqGrid
由于文件太大，删掉了所有的jar包，jar是整合struts2.1+spring2.5+hibernate3.2...</small></li><li><a href="http://www.mrzeng.com/post/jqgrid-css.html" title="jqGrid进阶教程：1、jqGrid的样式无法正确显示的原因和解决办法">jqGrid进阶教程：1、jqGrid的样式无法正确显示的原因和解决办法</a><br /><small>jqGrid引入后，执行，常常会碰到css无法像官方的demo一样正常显示，特别是字体还有一些弹出框，

例如
[caption id="attachment_407" align="alignnone" width="300" caption="CSS变样"][/caption]
这种问题的原因多半是因为html的标准问题，即其写法为




如果要让样式正常，要采用写法如下...</small></li><li><a href="http://www.mrzeng.com/post/jqgrid-base-study-11.html" title="jqGrid基础学习：11jqGrid的查询时和后台的交互">jqGrid基础学习：11jqGrid的查询时和后台的交互</a><br /><small>jqGrid查询时和后台交互是一个比较棘手的问题，因为发送过来的数据不规则。


单字段
我们通过Firefox的firebug来进行调试，我们发现提交搜索请求后，向后台发送的参数如下
[caption id="attachment_382" align="alignnone" width="300" caption="单字段同后台交互"][/caption]
由此，我们看出单字段查询...</small></li><li><a href="http://www.mrzeng.com/post/jqgrid-base-study-10.html" title="jqGrid基础学习：10jqGrid的多字段查询">jqGrid基础学习：10jqGrid的多字段查询</a><br /><small>多字段查询就是高级查询，在jqGrid中，高级查询的麻烦在于同后台的交互。

[caption id="attachment_379" align="alignnone" width="718" caption="jqGrid多字段查询"][/caption]

启用多条件查询的方法，是加上.searchGrid({multipleSearch:true});    即可。

    ...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.mrzeng.com/post/phprpc-java-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

