<?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; pear</title>
	<atom:link href="http://www.ooso.net/category/pear/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ooso.net</link>
	<description>Linux + Apache + Mysql + Php + Flash</description>
	<lastBuildDate>Mon, 15 Mar 2010 04:34:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Namespaces FAQ</title>
		<link>http://www.ooso.net/archives/418</link>
		<comments>http://www.ooso.net/archives/418#comments</comments>
		<pubDate>Tue, 10 Jun 2008 22:18:34 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[namespace]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=418</guid>
		<description><![CDATA[PHP Namespaces FAQ，适合没耐心仔细阅读完整README.namespaces的人来看.
Q. Why PHP needs namespaces?
A. Because long names like PEAR_Form_Loader_Validate_Table_Element_Validator_Exception are really tiresome.
Q. What is the main goal of the namespace implementation?

				<span class="readmore"><a href="http://www.ooso.net/archives/418" title="PHP Namespaces FAQ">阅读全文（1299字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>PHP Namespaces FAQ，适合没耐心仔细阅读<a href="http://cvs.php.net/viewvc.cgi/php-src/README.namespaces?view=markup">完整README.namespaces</a>的人来看.</p>
<blockquote><p>Q. Why PHP needs namespaces?<br />
A. Because long names like PEAR_Form_Loader_Validate_Table_Element_Validator_Exception are really tiresome.</p>
<p>Q. What is the main goal of the namespace implementation?<br />
A. To solve the problem above.</p>
<p>Q. What “namespace X::Y::Z” means?<br />
A: 1. All class/function/method names are prefixed with X::Y::Z.<br />
2. All class/function/method names are resolved first against X::Y::Z.</p>
<p>Q. What “import X::Y::Z as Foo” means?<br />
A. Every time there’s Foo as a class/function name or prefix to the name, it really means X::Y::Z</p>
<p>Q. What “import X::Y::Z” means?<br />
A. “import X::Y::Z as Z”, then see above.</p>
<p>Q. What “import Foo” means?<br />
A. Nothing.</p>
<p>Q. What is the scope of namespace and import?<br />
A. Current file.</p>
<p>Q. Can same namespace be used in multiple files?<br />
A. Yes.</p>
<p>Q. Is there any relation between namespaces X::Y::Z and X::Y?<br />
A. Only in programmer’s mind.</p>
<p>Q. How do I import all classes from namespace X::Y::Z into global space?<br />
A. You don’t, since it brings back the global space pollution problem.<br />
Instead, you import X::Y::Z and then prefix your classes with Z::.</p>
<p>Q. But doesn’t it mean I will still have long names?<br />
A. Not longer then three elements: Namespace::Class::Element.</p>
<p>Q. Why it is not implemented like in &lt;insert your favorite language here&gt;?<br />
A. Because PHP is not &lt;insert your favorite language here&gt;</p></blockquote>
<p>php是否需要namespace，我想第一条理由已经显得很充分了。用过<a href="/?tag=pear">PEAR</a>的可能会对其中超长的class命名印象深刻，所以在PEAR2的Code standing中，也隐约提到可能会利用namespaces以及__autoload来缩短class名。</p>
<p>原文:<a href="http://php100.wordpress.com/2007/08/17/namespaces-faq/">Namespaces FAQ</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/418/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>关于PEAR的DB和MDB2方法对比</title>
		<link>http://www.ooso.net/archives/396</link>
		<comments>http://www.ooso.net/archives/396#comments</comments>
		<pubDate>Thu, 08 May 2008 14:49:03 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[db]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/396</guid>
		<description><![CDATA[在从前的php4时代，我很喜欢使用pear的DB库，使用非常方便。但是现在pear官方站已经建议我们采用MDB2来代替它，虽然MDB2的前身可能有一些DB的影子，但是使用方法还是有一些不同，这些天一边使用，一边做些笔记。


MDB2

				<span class="readmore"><a href="http://www.ooso.net/archives/396" title="关于PEAR的DB和MDB2方法对比">阅读全文（265字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在从前的php4时代，我很喜欢使用<a href="/?tag=pear">pear</a>的DB库，使用非常方便。但是现在pear官方站已经建议我们采用MDB2来代替它，虽然MDB2的前身可能有一些DB的影子，但是使用方法还是有一些不同，这些天一边使用，一边做些笔记。</p>
<table border="1" cellpadding="3">
<tr bgcolor="#eee">
<td>MDB2</td>
<td>DB</td>
</tr>
<tr>
<td>queryAll</td>
<td>getAll</td>
</tr>
<tr>
<td>queryRow</td>
<td>getRow</td>
</tr>
<tr>
<td>queryCol</td>
<td>getCol</td>
</tr>
<tr>
<td>queryOne</td>
<td>getOne</td>
</tr>
<tr>
<td>autoExecute</td>
<td>autoExecute(需要载入extended module)</td>
</tr>
<tr>
<td>autoPrepare</td>
<td>autoPrepare(需要载入extended module)</td>
</tr>
</table>
<p>其它方法貌似一致。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/396/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>创建本地的pear</title>
		<link>http://www.ooso.net/archives/327</link>
		<comments>http://www.ooso.net/archives/327#comments</comments>
		<pubDate>Fri, 15 Jun 2007 23:46:37 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/327</guid>
		<description><![CDATA[在某些主机上，你可能没有修改系统缺省安装pear的权限，但是又希望安装自己的pear包。这种情况下也有简单的办法实现：
首先在自己的home下创建一份pear的配置文件.pearrc:
$ pear config-create $HOME .pearrc
如果一切顺利的话，直接进行下一步，否则运行一下下列命令：

				<span class="readmore"><a href="http://www.ooso.net/archives/327" title="创建本地的pear">阅读全文（712字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在某些主机上，你可能没有修改系统缺省安装pear的权限，但是又希望安装自己的<a href="index.php?tag=pear">pear</a>包。这种情况下也有简单的办法实现：</p>
<p>首先在自己的home下创建一份pear的配置文件.pearrc:<br />
<code>$ pear config-create $HOME .pearrc</code></p>
<p>如果一切顺利的话，直接进行下一步，否则运行一下下列命令：<br />
<code>$ pear config-set download_dir /home/(username)/tmp/pear/cache<br />
$ pear config-set cache_dir /home/(username)/tmp/pear/cache<br />
$ pear config-set temp_dir /home/(username)/tmp/pear/temp<br />
</code></p>
<p>接着就可以开始安装pear了，这会连着pear的依赖文件一块安装：<br />
<code>$ pear install -o PEAR</code></p>
<p>经过这一步,pear已经安装完成，如果你还希望安装其它的package，那么：<br />
<code>$ pear install pear/PackageName</code></p>
<p>这样你就有了一份自己定制的pear包，为了在程序中调用到这些pear，你需要多谢写一些额外的代码，毕竟这些代码还不在你的include_path中。</p>
<p>php4</p>
<div class="igBar"><span id="lcode-3"><a href="#" onclick="javascript:showCodeTxt('code-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-3">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ini_set<span style="color:#006600; font-weight:bold;">&#40;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#CC0000;">'include_path'</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; ini_get<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#CC0000;">'include_path'</span> <span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="">PATH_SEPARATOR</span> . <span style="color:#CC0000;">"/home/(youruser)/pear/php"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>php5</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showCodeTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set_include_path<span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; get_include_path<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> . </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="">PATH_SEPARATOR</span> . <span style="color:#CC0000;">'/home/(youruser)/pear/php'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/327/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Pear的PHP_Compat包</title>
		<link>http://www.ooso.net/archives/267</link>
		<comments>http://www.ooso.net/archives/267#comments</comments>
		<pubDate>Wed, 22 Nov 2006 23:42:14 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/267</guid>
		<description><![CDATA[Pear的PHP_Compat是个比较有趣的包,它提供了一些php4下也能使用的php5专有函数,比如file_put_contents,array_combine,str_split..........这样即使是在php4的主机上,也能提前享受一点php5函数的便利.
用法
PLAIN TEXT
PHP:

				<span class="readmore"><a href="http://www.ooso.net/archives/267" title="Pear的PHP_Compat包">阅读全文（239字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ooso.net/index.php/archives/category/pear/">Pear</a>的PHP_Compat是个比较有趣的包,它提供了一些php4下也能使用的<a href="http://www.ooso.net/?tag=php5">php5</a>专有函数,比如file_put_contents,array_combine,str_split..........这样即使是在php4的主机上,也能提前享受一点php5函数的便利.</p>
<h3>用法</h3>
<div class="igBar"><span id="lphp-6"><a href="#" onclick="javascript:showCodeTxt('php-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-6">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'PHP/Compat.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// load file_put_contents</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">PHP_Compat::<span style="color:#006600;">loadFunction</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'file_put_contents'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// load str_split, array_chunk and file_get_contents</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">PHP_Compat::<span style="color:#006600;">loadFunction</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'str_split'</span>, <span style="color:#FF0000;">'array_chunk'</span>, <span style="color:#FF0000;">'file_get_contents'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>上面的例子说明,可以一次载入n个php5特有函数</p>
<h3>Package Information: PHP_Compat</h3>
<p><a href="http://pear.php.net/package/PHP_Compat">http://pear.php.net/package/PHP_Compat</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/267/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pear::Pager和AJAX的整合应用</title>
		<link>http://www.ooso.net/archives/260</link>
		<comments>http://www.ooso.net/archives/260#comments</comments>
		<pubDate>Sun, 22 Oct 2006 23:53:07 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/260</guid>
		<description><![CDATA[作为一个PHP开发人员来说，大概很让人受用的一个东东就是Pear的类库了。我们知道，Pear::Pager是专门处理分页的，而Pear::HTML_AJAX则是Ajax应用的一些类库。但是Pager也不仅仅是只能用于html的分页链接，它已经为比超女还红的Ajax做好了准备，下面看看这两个包如何整合应用。
Pager and Javascript
现在走出第一步，Pager已经能够构建出javascript的链接了，和Ajax整合，理论上应该也是能够实现的，下面是Pager和javascript分页的一个例子：

				<span class="readmore"><a href="http://www.ooso.net/archives/260" title="Pear::Pager和AJAX的整合应用">阅读全文（1125字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>作为一个PHP开发人员来说，大概很让人受用的一个东东就是<a href="http://www.ooso.net/index.php/archives/category/pear/">Pear</a>的类库了。我们知道，Pear::<a href="http://www.ooso.net/index.php/archives/250">Pager</a>是专门处理分页的，而Pear::<a href="http://www.ooso.net/index.php/archives/184">HTML_AJAX</a>则是Ajax应用的一些类库。但是Pager也不仅仅是只能用于html的分页链接，它已经为比超女还红的Ajax做好了准备，下面看看这两个包如何整合应用。</p>
<h3>Pager and Javascript</h3>
<p>现在走出第一步，Pager已经能够构建出<a href="http://www.ooso.net/index.php/archives/category/javascript/">javascript</a>的链接了，和Ajax整合，理论上应该也是能够实现的，下面是Pager和javascript分页的一个例子：</p>
<div class="igBar"><span id="lphp-11"><a href="#" onclick="javascript:showCodeTxt('php-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-11">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'Pager/Pager.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$data</span> = <span style="color:#000066;">range</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span>, <span style="color:#CC66CC;color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">//an array of data to paginate</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager_params</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'mode'</span>&nbsp; &nbsp; &nbsp;=&gt; <span style="color:#FF0000;">'Sliding'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'append'</span>&nbsp; &nbsp;=&gt; <span style="color:#000000; font-weight:bold;">false</span>,&nbsp; <span style="color:#FF9933; font-style:italic;">//don't append the GET parameters to the url</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'path'</span>&nbsp; &nbsp; &nbsp;=&gt; <span style="color:#FF0000;">''</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'fileName'</span> =&gt; <span style="color:#FF0000;">'javascript:revealDiv(%d)'</span>,&nbsp; <span style="color:#FF9933; font-style:italic;">//Pager replaces &quot;%d&quot; with the page number...</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'perPage'</span>&nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">10</span>, <span style="color:#FF9933; font-style:italic;">//show 10 items per page</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'delta'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">5</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'itemData'</span> =&gt; <span style="color:#0000FF;">$data</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager</span> = &amp; Pager::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager_params</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$n_pages</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">numPages</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$links</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getLinks</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;html&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;head&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;script type=<span style="color:#FF0000;">"text/javascript"</span> language=<span style="color:#FF0000;">"javascript"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> n_pages = <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$n_pages</span> <span style="color:#000000; font-weight:bold;">?&gt;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> revealDiv<span style="color:#006600; font-weight:bold;">&#40;</span>n<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">var</span> <span style="color:#000066;">count</span> = <span style="color:#CC66CC;color:#800000;">1</span>; <span style="color:#000066;">count</span> &lt;= n_pages; <span style="color:#000066;">count</span>++<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"page"</span>+<span style="color:#000066;">count</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display = <span style="color:#FF0000;">'none'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"page"</span>+n<span style="color:#006600; font-weight:bold;">&#41;</span>.style.display = <span style="color:#FF0000;">'block'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;/script&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;style type=<span style="color:#FF0000;">"text/css"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; div.page <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; background: <span style="color:#008000; font-style:italic;">#FFFF99;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; border-top: 1px solid <span style="color:#008000; font-style:italic;">#FFBF99;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; border-bottom: 1px solid <span style="color:#008000; font-style:italic;">#FFBF99;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/style&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/head&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;body&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h1&gt;PEAR::<span style="color:#006600;">Pager</span> example with JavaScript&lt;/h1&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$links</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'pages'</span><span style="color:#006600; font-weight:bold;">&#93;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;hr /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span>=<span style="color:#CC66CC;color:#800000;">1</span>; <span style="color:#0000FF;">$i</span> &lt;= <span style="color:#0000FF;">$n_pages</span>; ++<span style="color:#0000FF;">$i</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;div class=&quot;page&quot; id=&quot;page'</span>.<span style="color:#0000FF;">$i</span>.<span style="color:#FF0000;">'&quot;&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;h2&gt;Page '</span>.<span style="color:#0000FF;">$i</span>.<span style="color:#FF0000;">'&lt;/h2&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getPageData</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$item</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'Item '</span>.<span style="color:#0000FF;">$item</span>.<span style="color:#FF0000;">'&lt;br /&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;/div&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;hr /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#FF0000;">"text/javascript"</span> language=<span style="color:#FF0000;">"javascript"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">revealDiv<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;/script&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/body&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/html&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>例子中把分页的所有数据放入一个div标签，定义了两个比较重要的参数就是path（为空）和fileName,fileName原本应该是链接的文件名，但是这里用javascript替换了。</p>
<h3>Ajax上阵</h3>
<p>这个例子包括三个文件page.html,server.php,testdata.php<br />
<span id="more-260"></span></p>
<li>page.html</li>
<p>用动态javascript--server.php来处理数据，调用HTML_AJAX.replace('target', 'testdata.php')来替换id为target这个div的内容。</p>
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showCodeTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;html&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;body&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h1&gt;PEAR::<span style="color:#006600;">Pager</span> example with AJAX&lt;/h1&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#FF0000;">"text/javascript"</span> src=<span style="color:#FF0000;">"server.php?client=all"</span>&gt;&lt;/script&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div id=<span style="color:#FF0000;">"target"</span>&gt;I<span style="color:#FF0000;">'m the target&lt;/div&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;script type=&quot;text/javascript&quot;&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; HTML_AJAX.replace('</span>target<span style="color:#FF0000;">', '</span>testdata.php<span style="color:#FF0000;">');</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;/script&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;/body&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;/html&gt; </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<li>testdata.php</li>
<p>这是个很简单的php程序，取到分页数据并输出html</p>
<div class="igBar"><span id="lphp-13"><a href="#" onclick="javascript:showCodeTxt('php-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-13">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'Pager/Pager.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$data</span> = <span style="color:#000066;">range</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span>, <span style="color:#CC66CC;color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">//an array of data to paginate</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager_params</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'mode'</span>&nbsp; &nbsp; &nbsp;=&gt; <span style="color:#FF0000;">'Sliding'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'append'</span>&nbsp; &nbsp;=&gt; <span style="color:#000000; font-weight:bold;">false</span>,&nbsp; <span style="color:#FF9933; font-style:italic;">//don't append the GET parameters to the url</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'path'</span>&nbsp; &nbsp; &nbsp;=&gt; <span style="color:#FF0000;">''</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'fileName'</span> =&gt; <span style="color:#FF0000;">'javascript:HTML_AJAX.replace(<span style="color:#000099; font-weight:bold;">\'</span>target<span style="color:#000099; font-weight:bold;">\'</span>,<span style="color:#000099; font-weight:bold;">\'</span>testdata.php?pageID=%d<span style="color:#000099; font-weight:bold;">\'</span>);'</span>,&nbsp; <span style="color:#FF9933; font-style:italic;">//Pager replaces &quot;%d&quot; with the page number...</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'perPage'</span>&nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">10</span>, <span style="color:#FF9933; font-style:italic;">//show 10 items per page</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'delta'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">1</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'itemData'</span> =&gt; <span style="color:#0000FF;">$data</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager</span> = &amp; Pager::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager_params</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$n_pages</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">numPages</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$links</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getLinks</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;p&gt;This container is loaded with an AJAX call&lt;/p&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;p&gt;&lt;span class=&quot;datetime&quot;&gt;DateTime: '</span>. <span style="color:#000066;">date</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Y-m-d H:i:s'</span><span style="color:#006600; font-weight:bold;">&#41;</span> .<span style="color:#FF0000;">'&lt;/span&gt;&lt;/p&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;h3&gt;Page '</span>. <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getCurrentPageId</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> .<span style="color:#FF0000;">'&lt;/h3&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getPageData</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$item</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'Item '</span>. <span style="color:#0000FF;">$item</span> .<span style="color:#FF0000;">'&lt;br /&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;hr /&gt;'</span>.<span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">links</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<li>最后，贴上幕后工作者server.php的代码</li>
<p>用HTML_AJAX_Server来处理ajax这些烦心事吧</p>
<div class="igBar"><span id="lphp-14"><a href="#" onclick="javascript:showCodeTxt('php-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-14">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span> <span style="color:#FF0000;">'HTML/AJAX/Server.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$server</span> = <span style="color:#000000; font-weight:bold;">new</span> HTML_AJAX_Server<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$server</span>-&gt;<span style="color:#006600;">handleRequest</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>web 2.0, Ajax的趋势图</h3>
<p>时下的web 2.0和Ajax概念正是如火如荼，且不论Ajax这东东到底是不是炒作的产物，就实际应用来说，Ajax在某些场合的确是顶好用而且看上去挺酷.</p>
<p><strong>蓝的是web 2.0,红的是Ajax</strong><br />
<img src="http://www.google.com/trends/viz?q=web+2.0,ajax&#038;date=all&#038;geo=all&#038;graph=weekly_img&#038;sa=N" alt="web 2.0,ajax" /></p>
<h3>参考文档</h3>
<p>http://www.alberton.info/pear_pager_tutorial_javascript_navigation.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/260/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pear::Pager分页类简介</title>
		<link>http://www.ooso.net/archives/250</link>
		<comments>http://www.ooso.net/archives/250#comments</comments>
		<pubDate>Thu, 21 Sep 2006 23:16:45 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/250</guid>
		<description><![CDATA[Pear的Pager分页类是一个很好用的php分页类,扩展性很强,能够适应各种分页情况的需求,至少我在几年间大大小小的项目里,基本上没有为分页额外写过代码,全部都是用的Pager,足见Pager的可用性之强.下面用代码来看看它的使用范例:
例子1
PLAIN TEXT
PHP:

				<span class="readmore"><a href="http://www.ooso.net/archives/250" title="Pear::Pager分页类简介">阅读全文（628字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ooso.net/index.php/archives/category/pear/">Pear</a>的<a href="http://pear.php.net/package/Pager">Pager</a>分页类是一个很好用的<a href="http://www.ooso.net/index.php/archives/category/php/">php</a>分页类,扩展性很强,能够适应各种分页情况的需求,至少我在几年间大大小小的项目里,基本上没有为分页额外写过代码,全部都是用的Pager,足见Pager的可用性之强.下面用代码来看看它的使用范例:</p>
<h3>例子1</h3>
<div class="igBar"><span id="lphp-17"><a href="#" onclick="javascript:showCodeTxt('php-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-17">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'Pager/Pager.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$params</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'mode'</span>&nbsp; &nbsp; &nbsp; &nbsp;=&gt; <span style="color:#FF0000;">'Jumping'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'perPage'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">3</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'delta'</span>&nbsp; &nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">2</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'itemData'</span>&nbsp; &nbsp;=&gt; <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'a'</span>,<span style="color:#FF0000;">'b'</span>,<span style="color:#FF0000;">'c'</span>,<span style="color:#FF0000;">'d'</span>,<span style="color:#FF0000;">'e'</span>,<span style="color:#006600; font-weight:bold;">&#91;</span>...omissis...<span style="color:#006600; font-weight:bold;">&#93;</span>,<span style="color:#FF0000;">'z'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager</span> = &amp; Pager::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$data</span>&nbsp; = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getPageData</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$links</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getLinks</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//$links is an ordered+associative array with 'back'/'pages'/'next'/'first'/'last'/'all' links</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//NB: $links['all'] is the same as $pager-&gt;links;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//echo links to other pages:</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#0000FF;">$links</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'all'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Pager can also generate &lt;link rel=&quot;first|prev|next|last&quot;&gt; tags</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">linkTags</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Show data for current page:</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'PAGED DATA: '</span> ; <span style="color:#000066;">print_r</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Results from methods:</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'getCurrentPageID()...: '</span>; <span style="color:#000066;">var_dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getCurrentPageID</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'getNextPageID()......: '</span>; <span style="color:#000066;">var_dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getNextPageID</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'getPreviousPageID()..: '</span>; <span style="color:#000066;">var_dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getPreviousPageID</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'numItems()...........: '</span>; <span style="color:#000066;">var_dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">numItems</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'numPages()...........: '</span>; <span style="color:#000066;">var_dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">numPages</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'isFirstPage()........: '</span>; <span style="color:#000066;">var_dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">isFirstPage</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'isLastPage().........: '</span>; <span style="color:#000066;">var_dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">isLastPage</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'isLastPageComplete().: '</span>; <span style="color:#000066;">var_dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">isLastPageComplete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'$pager-&gt;range........: '</span>; <span style="color:#000066;">var_dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">range</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Pager的使用,只要调整$param数组的参数,就可以应付很多种分页情况了.代码中的$links数组包含了一些链接,如上一页/页码/下一页/第一页/末页/全部.</p>
<h3>例2</h3>
<p>如今许多网站为了<a href="http://www.ooso.net/?tag=seo">SEO</a>,把动态页使用rewrite规则伪造成静态页的形式,例如下面这个.htaccess配置:</p>
<p><code>RewriteEngine on<br />
#Options FollowSymlinks</p>
<p>RewriteBase /<br />
RewriteRule ^articles/([a-z]{1,12})/art([0-9]{1,4})\.html$ /article.php?num=$2&amp;month=$1 [L]</code></p>
<p>即使在这种情况下,Pager分页仍然有办法工作,见下面的code</p>
<div class="igBar"><span id="lphp-18"><a href="#" onclick="javascript:showCodeTxt('php-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-18">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'Pager/Pager.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//first pager</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$params1</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'perPage'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">3</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'urlVar'</span>&nbsp; &nbsp; &nbsp;=&gt; pageID_articles,&nbsp; <span style="color:#FF9933; font-style:italic;">//1st identifier</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'itemData'</span>&nbsp; &nbsp;=&gt; <span style="color:#0000FF;">$someArray</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager1</span> = &amp; Pager::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$data1</span>&nbsp; = <span style="color:#0000FF;">$pager1</span>-&gt;<span style="color:#006600;">getPageData</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$links1</span> = <span style="color:#0000FF;">$pager1</span>-&gt;<span style="color:#006600;">getLinks</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//second pager</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$params2</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'perPage'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">8</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'urlVar'</span>&nbsp; &nbsp; &nbsp;=&gt; pageID_news,&nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//2nd identifier</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'itemData'</span>&nbsp; &nbsp;=&gt; <span style="color:#0000FF;">$someOtherArray</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager2</span> = &amp; Pager::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$data2</span>&nbsp; = <span style="color:#0000FF;">$pager2</span>-&gt;<span style="color:#006600;">getPageData</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$links2</span> = <span style="color:#0000FF;">$pager2</span>-&gt;<span style="color:#006600;">getLinks</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>通过配置$param,就能够把链接 "/articles/march/art15.html"对应到链接"/article.php?num=15&#038;month=march" ,比较灵活的表现</p>
<h3>扩展性</h3>
<p>Pager类的扩展性,平心而论,也是不错的.比如以前写的<a href="http://www.ooso.net/index.php/archives/144">path方式的分页类 - Pager::Pathing()</a>,这个方法就是从Pager上扩展而来,满足了当时的需求.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/250/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>在虚拟主机上复制安装本机Pear</title>
		<link>http://www.ooso.net/archives/241</link>
		<comments>http://www.ooso.net/archives/241#comments</comments>
		<pubDate>Fri, 15 Sep 2006 00:40:11 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/241</guid>
		<description><![CDATA[在国内租来的虚拟主机上,有部分主机本身就提供了pear类库,但是不用指望它们会给你升级或安装需要的pear包.在这种情况下,可以尝试在自己的虚拟主机下安装一份pear.
通过ssh安装pear
国内绝大部分虚拟主机都不提供ssh,但若是朋友的服务器,可能会比较放宽一点给你权限.下面看看通过ssh在虚拟主机上安装pear的步骤:


				<span class="readmore"><a href="http://www.ooso.net/archives/241" title="在虚拟主机上复制安装本机Pear">阅读全文（890字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在国内租来的虚拟主机上,有部分主机本身就提供了pear类库,但是不用指望它们会给你升级或安装需要的pear包.在这种情况下,可以尝试在自己的虚拟主机下安装一份pear.</p>
<h3>通过ssh安装pear</h3>
<p>国内绝大部分虚拟主机都不提供ssh,但若是朋友的服务器,可能会比较放宽一点给你权限.下面看看通过ssh在虚拟主机上安装pear的步骤:</p>
<ul>
<li>PEAR 1.3.5或以下:
<p><code>$ pear -s -c ~/.pearrc -d doc_dir=~/pear/docs \<br />
    -d ext_dir=~/pear/ext -d php_dir=~/pear/lib \<br />
    -d data_dir=~/pear/data -d test_dir=~/pear/tests \<br />
    -d cache_dir=~/pear/cache -d bin_dir=~/pear/bin</code></p>
<p>PEAR 1.4以上:<br />
<code>$ pear config-create /home/user/pear .pearrc</code></p>
<p>这样就在用户的home下建立了一个.pearrc文件
</li>
<li>在.bashrc文件中加入<br />
PEAR 1.3.2 或以下:<br />
	<code>$ pear -c ~/.pearrc install Archive_Tar PEAR Console_Getopt XML_RPC</code></p>
<p>PEAR 1.3.3以上<br />
	<code>$ pear install -o PEAR</code></p>
<p>这样就在用户的home目录下新增了一个pear目录,这份pear是完全复制主机上的pear的.</li>
<li>为了使用刚装上的这份pear包,需要在php代码中指定include_path
<div class="igBar"><span id="lphp-20"><a href="#" onclick="javascript:showCodeTxt('php-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-20">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">ini_set</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'include_path'</span>, <span style="color:#FF0000;">'~/pear/lib'</span> . PATH_SEPARATOR</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; . <span style="color:#000066;">ini_get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'include_path'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// From PHP 4.3.0 onward, you can use the following,</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// which especially useful on shared hosts:</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">set_include_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'~/pear/lib'</span> . PATH_SEPARATOR</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;. <span style="color:#000066;">get_include_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
</li>
</ul>
<h3>通过ftp/ftps/sftp安装pear</h3>
<p>通过ftp之类的向远程虚拟主机上安装pear,这无疑是个好主意.主要通过pear的程序包PEAR_RemoteInstaller来完成这功能.有几点要确定:</p>
<ul>
<li>本机是php 5.0以上</li>
<li>如果需要用ftps安装,那么本机的php需要增加openssl extension</li>
<li>如果需要用ssh安装,那么本机的php需要增加ssh2 extension</li>
<li>php目录的pear命令行可执行</li>
<li>ftp有写权限</li>
</ul>
<p>因为时间关系,暂时不写具体步骤了,有需要的朋友可以参考下面的链接.</p>
<h3>参考文档:</h3>
<p><a href="http://pear.php.net/manual/en/installation.shared.php">pear manual</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/241/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No handlers for package.xml version 2.0</title>
		<link>http://www.ooso.net/archives/243</link>
		<comments>http://www.ooso.net/archives/243#comments</comments>
		<pubDate>Tue, 12 Sep 2006 23:44:43 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/243</guid>
		<description><![CDATA[尝试在某主机安装Pear的DB_Table
pear install -o DB_Table
下载..............................等了半晌,在下载完之后,本应安装成功的时候,丢出来一句:
No handlers for package.xml version 2.0

				<span class="readmore"><a href="http://www.ooso.net/archives/243" title="No handlers for package.xml version 2.0">阅读全文（516字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>尝试在某主机安装<a href="http://www.ooso.net/index.php/archives/category/pear/">Pear</a>的<a href="http://www.ooso.net/index.php/archives/237">DB_Table</a></p>
<p><code>pear install -o DB_Table</code></p>
<p>下载..............................等了半晌,在下载完之后,本应安装成功的时候,丢出来一句:</p>
<blockquote><p>No handlers for package.xml version 2.0</p></blockquote>
<p>这实在是很奇怪的事情,<a href="http://www.ooso.net/index.php/archives/category/php/">php</a>的xml extension没少装,依赖包也不曾短缺了它的,它怎么就能这样呢?搜索了一把,在<a href="http://www.go-pear.org/manual/en/faq.no-handlers.php">Pear的Faq</a>上面找到了答案.</p>
<h3>Why do I get "No handlers for package.xml version 2.0" when I try to install a package?</h3>
<blockquote><p>You are using a PEAR version lower than 1.4.0. </p>
<p>To install the package, you have to update PEAR via: </p>
<p>$ pear upgrade PEAR </p>
<p>This will install the latest available version of PEAR which is capable of installing packages that have only a package.xml version 2.0. </p></blockquote>
<p>在升级Pear为1.4.11之后,问题解决.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/243/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Pear::HTTP_Upload简介</title>
		<link>http://www.ooso.net/archives/240</link>
		<comments>http://www.ooso.net/archives/240#comments</comments>
		<pubDate>Wed, 30 Aug 2006 01:58:30 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/240</guid>
		<description><![CDATA[Pear的HTTP_Upload类库提供了一个封装好的html表单文件上传处理程序，使用Pear的error系统。
特点

能一次处理多个文件的上传

				<span class="readmore"><a href="http://www.ooso.net/archives/240" title="Pear::HTTP_Upload简介">阅读全文（309字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>Pear的HTTP_Upload类库提供了一个封装好的html表单文件上传处理程序，使用<a href="http://www.ooso.net/index.php/archives/category/pear/">Pear</a>的error系统。</p>
<h3>特点</h3>
<ul>
<li>能一次处理多个文件的上传</li>
<li>容易校验文件的上传状态，限制不期望的文件上传</li>
<li>多语种的报错提示信息（还没有中文，不过可以扩展)</li>
</ul>
<h3>单个文件上传的例子</h3>
<p>index.htm</p>
<div class="igBar"><span id="lcode-25"><a href="#" onclick="javascript:showCodeTxt('code-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-25">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;form action=<span style="color:#CC0000;">"./files.php"</span> enctype=<span style="color:#CC0000;">"multipart/form-data"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">File <span style="color:#800000;color:#800000;">1</span>: &lt;input type=<span style="color:#CC0000;">"file"</span> name=<span style="color:#CC0000;">"userfile"</span>&gt;&lt;br&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input type=<span style="color:#CC0000;">"submit"</span> name=<span style="color:#CC0000;">"submit"</span> value=<span style="color:#CC0000;">"Upload!"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/form&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>files.php</p>
<div class="igBar"><span id="lphp-26"><a href="#" onclick="javascript:showCodeTxt('php-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-26">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require</span> <span style="color:#FF0000;">'HTTP/Upload.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$upload</span> = <span style="color:#000000; font-weight:bold;">new</span> HTTP_Upload<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'es'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Language for error messages</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$file</span> = <span style="color:#0000FF;">$upload</span>-&gt;<span style="color:#006600;">getFiles</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'userfile'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// return a file object or error</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>PEAR::<span style="color:#006600;">isError</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$file</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">die</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$file</span>-&gt;<span style="color:#006600;">getMessage</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Check if the file is a valid upload</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$file</span>-&gt;<span style="color:#006600;">isValid</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// this method will return the name of the file you moved,&nbsp; &nbsp; </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// useful for example to save the name in a database&nbsp; &nbsp; </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$file_name</span> = <span style="color:#0000FF;">$file</span>-&gt;<span style="color:#006600;">moveTo</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'./uploads_dir/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>PEAR::<span style="color:#006600;">isError</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$file_name</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">die</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$file_name</span>-&gt;<span style="color:#006600;">getMessage</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>多文件上传的例子</h3>
<p><span id="more-240"></span></p>
<div class="igBar"><span id="lcode-27"><a href="#" onclick="javascript:showCodeTxt('code-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-27">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;form action=<span style="color:#CC0000;">"files.php"</span> enctype=<span style="color:#CC0000;">"multipart/form-data"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Image <span style="color:#800000;color:#800000;">1</span>: &lt;input type=<span style="color:#CC0000;">"file"</span> name=<span style="color:#CC0000;">"userfile[]"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;br&gt;Image <span style="color:#800000;color:#800000;">2</span>: &lt;input type=<span style="color:#CC0000;">"file"</span> name=<span style="color:#CC0000;">"userfile[]"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;br&gt;Image <span style="color:#800000;color:#800000;">3</span>: &lt;input type=<span style="color:#CC0000;">"file"</span> name=<span style="color:#CC0000;">"userfile[]"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;br&gt;&lt;input type=<span style="color:#CC0000;">"submit"</span> name=<span style="color:#CC0000;">"sub"</span> value=<span style="color:#CC0000;">"Upload!"</span>&gt;&lt;/form&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lphp-28"><a href="#" onclick="javascript:showCodeTxt('php-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-28">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$files</span> = <span style="color:#0000FF;">$upload</span>-&gt;<span style="color:#006600;">getFiles</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// returns an array of file objects or error</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$files</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$file</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$file</span>-&gt;<span style="color:#006600;">isValid</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; ...&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>下载</h3>
<p><a href="http://pear.php.net/package/HTTP_Upload">http://pear.php.net/package/HTTP_Upload</a></p>
<p><strong>版权声明：可以任意转载，转载时请务必以超链接形式标明文章原始出处和作者信息及本声明</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/240/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Pear的命令行</title>
		<link>http://www.ooso.net/archives/239</link>
		<comments>http://www.ooso.net/archives/239#comments</comments>
		<pubDate>Mon, 28 Aug 2006 23:19:56 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/239</guid>
		<description><![CDATA[Pear是PHP扩展和应用库("PHP Extension and Application Repository")的缩写,注意它不是鸭梨,尽管和该水果的发音相同。在安装好php之后，缺省情况下会自动安装pear的部分程序库，我们看看这种情况下如何自行安装更多的应用库。
全自动安装
很简单，只用一行。
PLAIN TEXT

				<span class="readmore"><a href="http://www.ooso.net/archives/239" title="Pear的命令行">阅读全文（2276字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>Pear是<a href="http://www.ooso.net/index.php/archives/category/php/">PHP</a>扩展和应用库("PHP Extension and Application Repository")的缩写,注意它不是鸭梨,尽管和该水果的发音相同。在安装好php之后，缺省情况下会自动安装<a href="http://www.ooso.net/index.php/archives/category/pear/">pear</a>的部分程序库，我们看看这种情况下如何自行安装更多的应用库。</p>
<h3>全自动安装</h3>
<p>很简单，只用一行。</p>
<div class="igBar"><span id="lcode-31"><a href="#" onclick="javascript:showCodeTxt('code-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-31">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pear install &lt;package&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>&lt;package&gt;应当是你要安装的库名，可以到<a href="http://pear.php.net/packages.php">Pear的站上</a>浏览，相当丰富。也可以用命令行直接查看：</p>
<p><code>pear remote-list</code></p>
<p>提示：使用"-o"参数能够自动安装必需的依赖应用库。</p>
<h3>手动安装</h3>
<p>如果你直接在pear站上下载了gzip的安装包，可以采用这种安装形式。pear会自动安装这个应用库，不再链接到网上去下载。</p>
<div class="igBar"><span id="lcode-32"><a href="#" onclick="javascript:showCodeTxt('code-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-32">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">pear install &lt;file&gt;.<span style="">tgz</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>命令清单</h3>
<p><span id="more-239"></span></p>
<table border="1">
<thead>
<tr>
<th align="left" valign="middle">Command</th>
<th align="left" valign="middle">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" valign="middle">build</td>
<td align="left" valign="middle">Build the extension<br />
              from source</td>
</tr>
<tr>
<td align="left" valign="middle">bundle</td>
<td align="left" valign="middle">Download and unpack<br />
              a <a href="http://pecl.php.net/">PECL</a> extension</td>
</tr>
<tr>
<td align="left" valign="middle">channel-add</td>
<td align="left" valign="middle">Add a Channel (PEAR<br />
              1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">channel-alias</td>
<td align="left" valign="middle">Specify an alias to<br />
              a channel name (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">channel-delete</td>
<td align="left" valign="middle">Remove a channel<br />
              from the list (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">
              channel-discover</td>
<td align="left" valign="middle">Initialize a channel<br />
              from its server name (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">channel-info</td>
<td align="left" valign="middle">Retrieve information<br />
              on a channel (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">channel-update</td>
<td align="left" valign="middle">Update an existing<br />
              channel (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">clear-cache</td>
<td align="left" valign="middle">Clear the XML-RPC<br />
              cache</td>
</tr>
<tr>
<td align="left" valign="middle">config-create</td>
<td align="left" valign="middle">Create a default<br />
              configuration file (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">config-get</td>
<td align="left" valign="middle">Echo a specific<br />
              configuration setting</td>
</tr>
<tr>
<td align="left" valign="middle">config-help</td>
<td align="left" valign="middle">Show information<br />
              about a setting</td>
</tr>
<tr>
<td align="left" valign="middle">config-set</td>
<td align="left" valign="middle">Set a specific<br />
              configuration setting value</td>
</tr>
<tr>
<td align="left" valign="middle">config-show</td>
<td align="left" valign="middle">Show all<br />
              configuration setting values</td>
</tr>
<tr>
<td align="left" valign="middle">convert</td>
<td align="left" valign="middle">Convert a<br />
              package.xml 1.0 format to package.xml 2.0 format<br />
              (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">cvsdiff</td>
<td align="left" valign="middle">Execute and display<br />
              a "<tt class="literal">cvs diff -u</tt>" on all files<br />
              within the package</td>
</tr>
<tr>
<td align="left" valign="middle">cvstag</td>
<td align="left" valign="middle">Set a CVS release<br />
              tag</td>
</tr>
<tr>
<td align="left" valign="middle">download</td>
<td align="left" valign="middle">Download a package<br />
              but not install it</td>
</tr>
<tr>
<td align="left" valign="middle">download-all</td>
<td align="left" valign="middle">Downloads every<br />
              available package</td>
</tr>
<tr>
<td align="left" valign="middle">info</td>
<td align="left" valign="middle">Display information<br />
              about a package</td>
</tr>
<tr>
<td align="left" valign="middle">install</td>
<td align="left" valign="middle">Install a package,<br />
              will report with success or failure</td>
</tr>
<tr>
<td align="left" valign="middle">list</td>
<td align="left" valign="middle">List installed<br />
              packages</td>
</tr>
<tr>
<td align="left" valign="middle">list-all</td>
<td align="left" valign="middle">List all packages,<br />
              packaged and/or available</td>
</tr>
<tr>
<td align="left" valign="middle">list-channels</td>
<td align="left" valign="middle">List available<br />
              channels (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">list-files</td>
<td align="left" valign="middle">List files in an<br />
              installed package (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">list-upgrades</td>
<td align="left" valign="middle">List available<br />
              upgrades for the installed packages</td>
</tr>
<tr>
<td align="left" valign="middle">login</td>
<td align="left" valign="middle">Connects and<br />
              authenticates to the remote PEAR server</td>
</tr>
<tr>
<td align="left" valign="middle">logout</td>
<td align="left" valign="middle">Logs out from the<br />
              remote PEAR server</td>
</tr>
<tr>
<td align="left" valign="middle">makerpm</td>
<td align="left" valign="middle">Builds a RPM spec<br />
              file from a PEAR package</td>
</tr>
<tr>
<td align="left" valign="middle">package</td>
<td align="left" valign="middle">Build a package</td>
</tr>
<tr>
<td align="left" valign="middle">
              package-dependencies</td>
<td align="left" valign="middle">Show package<br />
              dependencies</td>
</tr>
<tr>
<td align="left" valign="middle">
              package-validate</td>
<td align="left" valign="middle">Validate package<br />
              consistency</td>
</tr>
<tr>
<td align="left" valign="middle">remote-info</td>
<td align="left" valign="middle">Information about<br />
              remote packages</td>
</tr>
<tr>
<td align="left" valign="middle">remote-list</td>
<td align="left" valign="middle">List remote<br />
              packages</td>
</tr>
<tr>
<td align="left" valign="middle">run-scripts</td>
<td align="left" valign="middle">Run post-install<br />
              scripts bundled with a package (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">run-tests</td>
<td align="left" valign="middle">Run regression<br />
              tests</td>
</tr>
<tr>
<td align="left" valign="middle">search</td>
<td align="left" valign="middle">Search the remote<br />
              package database</td>
</tr>
<tr>
<td align="left" valign="middle">shell-test</td>
<td align="left" valign="middle">Do a shell script<br />
              test</td>
</tr>
<tr>
<td align="left" valign="middle">sign</td>
<td align="left" valign="middle">Sign a package<br />
              distribution file</td>
</tr>
<tr>
<td align="left" valign="middle">uninstall</td>
<td align="left" valign="middle">Uninstall and remove<br />
              a package</td>
</tr>
<tr>
<td align="left" valign="middle">update-channels</td>
<td align="left" valign="middle">Update the channel<br />
              list (PEAR 1.4+)</td>
</tr>
<tr>
<td align="left" valign="middle">upgrade</td>
<td align="left" valign="middle">Upgrade a package to<br />
              the current version (see also: preferred_state)</td>
</tr>
<tr>
<td align="left" valign="middle">upgrade-all</td>
<td align="left" valign="middle">Upgrade all packages<br />
              (see also: list-upgrades)</td>
</tr>
</tbody>
</table>
<h3>参考</h3>
<ul>
<li><a href="http://pear.php.net">pear.php.net</a></li>
</ul>
<p><strong>版权声明：可以任意转载，转载时请务必以超链接形式标明文章原始出处和作者信息及本声明</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/239/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pear::DB_Table简介</title>
		<link>http://www.ooso.net/archives/237</link>
		<comments>http://www.ooso.net/archives/237#comments</comments>
		<pubDate>Sun, 27 Aug 2006 02:43:40 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/237</guid>
		<description><![CDATA[版权声明：可以任意转载，转载时请务必以超链接形式标明文章原始出处和作者信息及本声明
DB_Table是什么？
DB_Table 是一个访问数据库Table的OO接口，它提供了一些自动创建、插入、更新和选择的方法。自动构建往往意味着要丧失一些灵活性，DB_Table也不能例外。
安装

				<span class="readmore"><a href="http://www.ooso.net/archives/237" title="Pear::DB_Table简介">阅读全文（273字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><strong>版权声明：可以任意转载，转载时请务必以超链接形式标明文章原始出处和作者信息及本声明</strong></p>
<h3>DB_Table是什么？</h3>
<p>DB_Table 是一个访问数据库Table的OO接口，它提供了一些自动创建、插入、更新和选择的方法。自动构建往往意味着要丧失一些灵活性，DB_Table也不能例外。</p>
<h3>安装</h3>
<p><a href="http://www.ooso.net/index.php/archives/category/pear/">pear</a>的程序库的安装没什么悬念<br />
<code>pear install DB_Table</code></p>
<h3>DB_Table上手</h3>
<p>官方介绍上推荐不要直接使用DB_Table Class，而是对它进行扩展，在这之上再定义字段，索引，视图等等其它自定义内容。下面来看看如何对DB_Table扩展。</p>
<p><span id="more-237"></span></p>
<h4>基本的例子：</h4>
<div class="igBar"><span id="lphp-44"><a href="#" onclick="javascript:showCodeTxt('php-44'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-44">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Guestbook extends DB_Table <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// 稍后补充 We'll add more here later in the tutorial,</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// 注意，没有构造函数 but for now this is all we need. </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>接着，实例化一个Guestbook</p>
<div class="igBar"><span id="lphp-45"><a href="#" onclick="javascript:showCodeTxt('php-45'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-45">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// 必须的class</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'DB.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'DB/Table.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'Guestbook.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// create a PEAR DB object</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$dsn</span> = <span style="color:#FF0000;">"phptype://username:password@localhost/database"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$db</span> = DB::<span style="color:#006600;">connect</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$dsn</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// set up for the Guestbook and create it, connecting</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// to a table called 'guestbook' (which does not exist</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// yet, we'll get to that in the next section)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$book</span> =&amp; <span style="color:#000000; font-weight:bold;">new</span> Guestbook<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$db</span>, <span style="color:#FF0000;">'guestbook'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// note the &quot;=&amp;&quot; (very important!)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>可以用PEAR_Error来查看是否有错</p>
<div class="igBar"><span id="lphp-46"><a href="#" onclick="javascript:showCodeTxt('php-46'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-46">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$book</span>-&gt;<span style="color:#006600;">error</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// error handling code goes here; for example ...</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">print_r</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$book</span>-&gt;<span style="color:#006600;">error</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// ... although that's probably a bad idea as it will print</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// your database username and password.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>下面看看如何详细定义Guestbook类,这个例子里定义了guestbook表的各个字段类型：</p>
<div class="igBar"><span id="lphp-47"><a href="#" onclick="javascript:showCodeTxt('php-47'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-47">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Guestbook extends DB_Table <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$col</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// unique row ID</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'id'</span> =&gt; <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'type'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'integer'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'require'</span> =&gt; <span style="color:#000000; font-weight:bold;">true</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// first name</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'fname'</span> =&gt; <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'type'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'varchar'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'size'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">32</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// last name</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'lname'</span> =&gt; <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'type'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'varchar'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'size'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">64</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// email address</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'email'</span> =&gt; <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'type'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'varchar'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'size'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">128</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'require'</span> =&gt; <span style="color:#000000; font-weight:bold;">true</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// date-time signed</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'signdate'</span> =&gt; <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'type'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'date'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'require'</span> =&gt; <span style="color:#000000; font-weight:bold;">true</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>如果要进一步定义guestbook表的索引，可以这样进行：</p>
<div class="igBar"><span id="lphp-48"><a href="#" onclick="javascript:showCodeTxt('php-48'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-48">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Guestbook extends DB_Table <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// snip: var $col = array(...);&nbsp; 这部分内容和上面那段一样，省略</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$idx</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'id'</span> =&gt; <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'type'</span> =&gt; <span style="color:#FF0000;">'unique'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'cols'</span> =&gt; <span style="color:#FF0000;">'id'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'signdate'</span> =&gt; <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'type'</span> =&gt; <span style="color:#FF0000;">'normal'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'cols'</span> =&gt; <span style="color:#FF0000;">'signdate'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>如果索引和字段名是一样的，而且不是多字段索引，上面的定义可以简化为：</p>
<div class="igBar"><span id="lphp-49"><a href="#" onclick="javascript:showCodeTxt('php-49'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-49">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$idx</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// unique index called 'id' based on the 'id' column</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'id'</span> =&gt; <span style="color:#FF0000;">'unique'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// normal index called 'signdate' based on the 'signdate' column</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'signdate'</span> =&gt; <span style="color:#FF0000;">'normal'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>定义好表结构之后，我们看看如何进行查询，看上去非常简单，没有sql语句的痕迹：</p>
<div class="igBar"><span id="lphp-50"><a href="#" onclick="javascript:showCodeTxt('php-50'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-50">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// [snip] create the $book Guestbook object</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// get the 'list' view as an array</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rows</span> = <span style="color:#0000FF;">$book</span>-&gt;<span style="color:#006600;">select</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'list'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">print_r</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rows</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// get the 'emails' view as a DB_Result object</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$result</span> = <span style="color:#0000FF;">$book</span>-&gt;<span style="color:#006600;">selectResult</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'emails'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">print_r</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>按条件查询：</h4>
<div class="igBar"><span id="lphp-51"><a href="#" onclick="javascript:showCodeTxt('php-51'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-51">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// [snip] create the $book Guestbook object</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// get 'list' view rows signed on August 14, 2003, ordered ascending by</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// last name and first name, starting at row 7 and getting 12 rows total.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$view</span> = <span style="color:#FF0000;">'list'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$filter</span> = <span style="color:#FF0000;">"signdate = '2003-08-14'"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$order</span> = <span style="color:#FF0000;">'lname, fname'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$start</span> = <span style="color:#CC66CC;color:#800000;">7</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$count</span> = <span style="color:#CC66CC;color:#800000;">12</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// as an array</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rows</span> = <span style="color:#0000FF;">$book</span>-&gt;<span style="color:#006600;">select</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$view</span>, <span style="color:#0000FF;">$filter</span>, <span style="color:#0000FF;">$order</span>, <span style="color:#0000FF;">$start</span>, <span style="color:#0000FF;">$count</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">print_r</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rows</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// as a DB_Result object</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rows</span> = <span style="color:#0000FF;">$book</span>-&gt;<span style="color:#006600;">selectResult</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$view</span>, <span style="color:#0000FF;">$filter</span>, <span style="color:#0000FF;">$order</span>, <span style="color:#0000FF;">$start</span>, <span style="color:#0000FF;">$count</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">print_r</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>数据插入</h4>
<div class="igBar"><span id="lphp-52"><a href="#" onclick="javascript:showCodeTxt('php-52'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-52">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// [snip] create the Guestbook object ($book)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// assign the fields and values</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$cols_vals</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'id'</span>&nbsp; &nbsp; &nbsp; &nbsp;=&gt; <span style="color:#CC66CC;color:#800000;">1</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'fname'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'Thomas'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'lname'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'Anderson'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'signdate'</span> =&gt; <span style="color:#FF0000;">'2003-10-12'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'email'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'neo@matrix.net'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// insert into the table and print results</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$result</span> = <span style="color:#0000FF;">$book</span>-&gt;<span style="color:#006600;">insert</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cols_vals</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">print_r</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>数据更新</h4>
<div class="igBar"><span id="lphp-53"><a href="#" onclick="javascript:showCodeTxt('php-53'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-53">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// [snip] create the Guestbook object ($book)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// assign the updated fields and values</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$cols_vals</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'lname'</span> =&gt; <span style="color:#FF0000;">'Jones'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// assign the WHERE clause</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$where</span> = <span style="color:#FF0000;">"lname = 'Smith'"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// attempt the update and print the results</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$result</span> = <span style="color:#0000FF;">$book</span>-&gt;<span style="color:#006600;">update</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cols_vals</span>, <span style="color:#0000FF;">$where</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">print_r</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>数据删除</h3>
<div class="igBar"><span id="lphp-54"><a href="#" onclick="javascript:showCodeTxt('php-54'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-54">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// [snip] create the Guestbook object ($book)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// a where clause</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$today</span> = <span style="color:#000066;">date</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Y-m-d'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// formatted as yyyy-mm-dd</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$where</span> = <span style="color:#FF0000;">"signdate &lt;'$today'"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// attempt the delete and print the results</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$result</span> = <span style="color:#0000FF;">$book</span>-&gt;<span style="color:#006600;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$where</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">print_r</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>在上面的例子中已经没有太多sql语句的痕迹了，这可以在一定程度上简化开发过程中sql语句的编写，但是还是那句话，自动化的同时降低了灵活性，在使用DB_Table之前需要权衡。</p>
<h3>参考</h3>
<p><a href="http://wiki.ciaweb.net/yawiki/index.php?area=DB_Table&#038;page=HomePage">http://wiki.ciaweb.net/yawiki/index.php?area=DB_Table&#038;page=HomePage</a></p>
<h3>下载源码</h3>
<p><a href="http://pear.php.net/package/DB_Table">http://pear.php.net/package/DB_Table</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/237/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP 5.2.0 RC1发布</title>
		<link>http://www.ooso.net/archives/202</link>
		<comments>http://www.ooso.net/archives/202#comments</comments>
		<pubDate>Wed, 26 Jul 2006 22:51:56 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/202</guid>
		<description><![CDATA[PHP 5.2.0 RC1发布，目前应该只是个样品，适合下载回来测试新功能。主要更新是新增了三个extensions:

filter
json 

				<span class="readmore"><a href="http://www.ooso.net/archives/202" title="PHP 5.2.0 RC1发布">阅读全文（726字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><a href="http://ilia.ws/archives/119-PHP-5.2.0-RC1-Released!.html">PHP 5.2.0 RC1</a>发布，目前应该只是个样品，适合下载回来测试新功能。主要更新是新增了三个extensions:</p>
<ul>
<li><a href="http://cn.php.net/manual/en/ref.filter.php">filter</a></li>
<li><a href="http://www.ooso.net/?tag=json">json </a></li>
<li>zip</li>
</ul>
<p>其中filter extension由Rasmus Lerdorf提供，帮助php开发者过滤用户提交的内容。原来是在<a href="http://pecl.php.net">pecl.php.net</a>，更详细的内容可以看这里：<a href="http://oss.backendmedia.com/PeclFilter">http://oss.backendmedia.com/PeclFilter</a>，如能广泛使用，目前php开发的安全性将提升一个台阶！之前还听说对pdo extension有些调整，比如新增了<a href="http://cn.php.net/manual/en/function.pdostatement-setfetchmode.php">setFetchMode</a>方法，经常使用<a href="http://www.ooso.net/index.php/archives/category/pear/">Pear</a>:DB的同学一定不会陌生。</p>
<blockquote><p>Given that it took a few months to reach this point and addition of new features was allowed the changelog already looks extremely impressive. Some of the key changes include things like 3 new extensions (filter, json and zip), the date extension had the rest of its functionality enabled, much work was done in terms of getting PHP 5.2 to run faster and more efficiently (in terms on memory usage). There have also been nearly 80 bug fixes made to existing functionality, which hopefully translates to a more stable release.</p></blockquote>
<h3>下载</h3>
<ul>
<li><a href="http://downloads.php.net/ilia/php-5.2.0RC1.tar.bz2">bz包</a></li>
<li><a href="http://downloads.php.net/ilia/php-5.2.0RC1.tar.gz">gzip包</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/202/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>利用http_request上传文件</title>
		<link>http://www.ooso.net/archives/187</link>
		<comments>http://www.ooso.net/archives/187#comments</comments>
		<pubDate>Sun, 11 Jun 2006 15:15:11 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/187</guid>
		<description><![CDATA[有时候我们希望用脚本来自动往远端某个表单中自动添加文件上传,利用curl模块可能是个办法,但是直接使用pear的http_request可能是个更便捷的办法,简单的例子:
PLAIN TEXT
PHP:


				<span class="readmore"><a href="http://www.ooso.net/archives/187" title="利用http_request上传文件">阅读全文（502字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>有时候我们希望用脚本来自动往远端某个表单中自动添加文件上传,利用curl模块可能是个办法,但是直接使用<a href="http://pear.php.net">pear</a>的http_request可能是个更便捷的办法,简单的例子:</p>
<div class="igBar"><span id="lphp-56"><a href="#" onclick="javascript:showCodeTxt('php-56'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-56">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">"HTTP/Request.php"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$req</span> =&amp; <span style="color:#000000; font-weight:bold;">new</span> HTTP_Request<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"http://upload.example.com/upload.php"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$req</span>-&gt;<span style="color:#006600;">setBasicAuth</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"johndoe"</span>, <span style="color:#FF0000;">"foo"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$req</span>-&gt;<span style="color:#006600;">setMethod</span><span style="color:#006600; font-weight:bold;">&#40;</span>HTTP_REQUEST_METHOD_POST<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$result</span> = <span style="color:#0000FF;">$req</span>-&gt;<span style="color:#006600;">addFile</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"foo.jpg"</span>, <span style="color:#FF0000;">"/home/foo/foo.jpg"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>PEAR::<span style="color:#006600;">isError</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$result</span>-&gt;<span style="color:#006600;">getMessage</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$response</span> = <span style="color:#0000FF;">$req</span>-&gt;<span style="color:#006600;">sendRequest</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>PEAR::<span style="color:#006600;">isError</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$response</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$response</span>-&gt;<span style="color:#006600;">getMessage</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$req</span>-&gt;<span style="color:#006600;">getResponseBody</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/187/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>用php将rss转化为json格式</title>
		<link>http://www.ooso.net/archives/184</link>
		<comments>http://www.ooso.net/archives/184#comments</comments>
		<pubDate>Mon, 29 May 2006 06:41:38 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[json]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/184</guid>
		<description><![CDATA[要用php将rss转换成json,简单的转换思路是:
rss -> php array -> json
我们不必从头进行这些工作,pear已经提供了一些可用的类库,到命令行下面利用pear安装这些包
pear install channel://pear.php.net/XML_RSS-0.9.9

				<span class="readmore"><a href="http://www.ooso.net/archives/184" title="用php将rss转化为json格式">阅读全文（453字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>要用php将rss转换成json,简单的转换思路是:<br />
rss -> php array -> json</p>
<p>我们不必从头进行这些工作,pear已经提供了一些可用的类库,到命令行下面利用pear安装这些包<br />
pear install channel://pear.php.net/XML_RSS-0.9.9<br />
pear install channel://pear.php.net/HTML_AJAX-0.4.0</p>
<p>下面是一个简单的测试代码:</p>
<div class="igBar"><span id="lphp-58"><a href="#" onclick="javascript:showCodeTxt('php-58'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-58">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'XML/RSS.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require</span> <span style="color:#FF0000;">'HTML/AJAX/JSON.PHP'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rss</span> = <span style="color:#000000; font-weight:bold;">new</span> XML_RSS<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'http://www.ooso.net/index.php/feed/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rss</span>-&gt;<span style="color:#006600;">parse</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//var_dump($rss-&gt;getItems());</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$json</span> = <span style="color:#000000; font-weight:bold;">new</span> HTML_AJAX_JSON<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$js</span> = <span style="color:#0000FF;">$json</span>-&gt;<span style="color:#006600;">encode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rss</span>-&gt;<span style="color:#006600;">getItems</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#0000FF;">$js</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<ul>
<li><a href="http://www.yahoo.com.cn/search?p=json">什么是json?</a></li>
<li><a href="http://www.google.com/search?q=site%3Awww.ooso.net+json">相关文章</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/184/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>php+ajax文件上传进度条</title>
		<link>http://www.ooso.net/archives/169</link>
		<comments>http://www.ooso.net/archives/169#comments</comments>
		<pubDate>Wed, 15 Mar 2006 02:39:50 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/169</guid>
		<description><![CDATA[找到一篇文章PHP AJAX File Upload Progress Meter Updates,介绍如何用php Pear:HTML_AJAX制作带有进度条的文件上传,下面是我测试上传时的示意图
 

代码分为以下部分:

				<span class="readmore"><a href="http://www.ooso.net/archives/169" title="php+ajax文件上传进度条">阅读全文（990字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>找到一篇文章<a href="http://blog.joshuaeichorn.com/archives/2006/03/14/php-ajax-file-upload-progress-meter-updates/" target="_blank">PHP AJAX File Upload Progress Meter Updates</a>,介绍如何用<a href="http://www.php.net" target="_blank">php</a> <a href="http://pear.php.net/package/HTML_AJAX" target="_blank">Pear:HTML_AJAX</a>制作带有进度条的文件上传,下面是我测试上传时的示意图</p>
<p><img title="ajax带进度条上传" alt="ajax带进度条上传" src="http://image.blog.myrice.com/vvvv/imgs/0/8/08c345da.gif" /> </p>
<p><span id="more-169"></span><br />
代码分为以下部分:</p>
<p>demo.php - 上传过程处理</p>
<div class="igBar"><span id="lphp-63"><a href="#" onclick="javascript:showCodeTxt('php-63'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-63">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span> <span style="color:#FF0000;">'UploadProgressMeter.class.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$fileWidget</span> = <span style="color:#000000; font-weight:bold;">new</span> UploadProgressMeter<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fileWidget</span>-&gt;<span style="color:#006600;">uploadComplete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// 上传完毕的时候,从iframe发送一个js到主窗口表示一切ok</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$fileWidget</span>-&gt;<span style="color:#006600;">finalStatus</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// 处理上传后的文件...</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">exit</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>demoserver.php - ajax的服务端js,使用Pear:HTML_AJAX,直接调用UploadProgressMeterStatus类</p>
<div class="igBar"><span id="lhtml-64"><a href="#" onclick="javascript:showCodeTxt('html-64'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-64">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://www.ooso.net/demoserver.php?client=main,request,httpclient,dispatcher,json,util"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://www.ooso.net/demoserver.php?stub=UploadProgressMeterStatus"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php echo $fileWidget-<span style="color: #000000; font-weight: bold;">&gt;</span></span>renderIncludeJs(); ?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>进度条的样式表</p>
<div class="igBar"><span id="lcss-65"><a href="#" onclick="javascript:showCodeTxt('css-65'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-65">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.progressBar </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">relative</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">padding</span>: 2px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">width</span>: 300px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">height</span>: 40px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">font-size</span>: 14px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.progressBar </span><span style="color: #6666ff;">.<span style="color: #000000; font-weight: bold;">background</span> </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">border</span>: <span style="color: #993333;">solid</span> 1px <span style="color: #000000; font-weight: bold;">black</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">width</span>: 270px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">height</span>: 20px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.progressBar </span><span style="color: #6666ff;">.bar </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">relative</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">background-color</span>: <span style="color: #000000; font-weight: bold;">blue</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">width</span>: 0px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">height</span>: 20px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>表单部分</p>
<div class="igBar"><span id="lhtml-66"><a href="#" onclick="javascript:showCodeTxt('html-66'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-66">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">"demo.php"</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"post"</span> <span style="color: #000066;">enctype</span>=<span style="color: #ff0000;">"multipart/form-data"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>renderFormExtra(); ?&gt;&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php echo $fileWidget-<span style="color: #000000; font-weight: bold;">&gt;</span></span>renderHidden(); ?&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">"demo.php"</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"post"</span> <span style="color: #000066;">enctype</span>=<span style="color: #ff0000;">"multipart/form-data"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label&gt;</span></span>Select File: <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php echo $fileWidget-<span style="color: #000000; font-weight: bold;">&gt;</span></span>render(); ?&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php echo $fileWidget-<span style="color: #000000; font-weight: bold;">&gt;</span></span>renderProgressBar(); ?&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><a href="http://www.ooso.net/temp/demo/upload.rar" target="_blank">demo下载</a> - 密码是<a href="http://www.ooso.net/">www.ooso.net</a><br />
作者的<a href="http://svn.bluga.net/HTML_AJAX/UploadProgressMeter/trunk/" target="_blank">svn浏览</a></p>
<p>其它类似项目:<br />
<a href="http://pdoru.from.ro/">http://pdoru.from.ro/</a> - 要以patch的形式和php一起编译<br />
<a href="http://www.ugia.cn/?p=54">http://www.ugia.cn/?p=54</a> - 以socket上传文件并显示进度条</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/169/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>俺的按比例裁切缩略图函数</title>
		<link>http://www.ooso.net/archives/166</link>
		<comments>http://www.ooso.net/archives/166#comments</comments>
		<pubDate>Mon, 13 Mar 2006 07:04:52 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/166</guid>
		<description><![CDATA[为了减少代码量,这里直接使用了Pear::Image_Transform图片处理类,功能是按比例生成缩略图，缩小后图片效果不变形，如果超高则纵向截取，如果超长则横向截取。
PLAIN TEXT
PHP:


				<span class="readmore"><a href="http://www.ooso.net/archives/166" title="俺的按比例裁切缩略图函数">阅读全文（948字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>为了减少代码量,这里直接使用了<a href="http://pear.php.net" target="_blank">Pear</a>::<a href="http://pear.php.net/package/Image_Transform" target="_blank">Image_Transform</a>图片处理类,功能是按比例生成缩略图，缩小后图片效果不变形，如果超高则纵向截取，如果超长则横向截取。<span id="more-166"></span></p>
<div class="igBar"><span id="lphp-68"><a href="#" onclick="javascript:showCodeTxt('php-68'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-68">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">* 生成缩略图</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">* @param string $src 源图片路径</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">* @param string $dst 目标图片路径</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">* @param int $width 缩略图宽</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">* @param int $height 缩略图高</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">* @return bool</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*/</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> cropImg<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$src</span>, <span style="color:#0000FF;">$dst</span>, <span style="color:#0000FF;">$width</span>, <span style="color:#0000FF;">$height</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#FF9933; font-style:italic;">//Pear::Image_Transform</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#616100;">include_once</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Image/Transform.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$img</span> = Image_Transform::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'GD'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$src</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$size</span> = <span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">getImageSize</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">empty</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> / <span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>&gt; <span style="color:#0000FF;">$width</span> / <span style="color:#0000FF;">$height</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$w</span> = <span style="color:#000066;">round</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> * <span style="color:#0000FF;">$height</span> / <span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$h</span> = <span style="color:#0000FF;">$height</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$over</span> = <span style="color:#FF0000;">'width'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$w</span> = <span style="color:#0000FF;">$width</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$h</span> = <span style="color:#000066;">round</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> * <span style="color:#0000FF;">$width</span> / <span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$over</span> = <span style="color:#FF0000;">'height'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">resize</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$w</span>, <span style="color:#0000FF;">$h</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">save</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$dst</span>, <span style="color:#FF0000;">'jpeg'</span>, <span style="color:#CC66CC;color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">free</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$dst</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$size</span> = <span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">getImageSize</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$over</span> == <span style="color:#FF0000;">'width'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$x</span> = <span style="color:#000066;">round</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> - <span style="color:#0000FF;">$width</span><span style="color:#006600; font-weight:bold;">&#41;</span> / <span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$y</span> = <span style="color:#CC66CC;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$x</span> = <span style="color:#CC66CC;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$y</span> = <span style="color:#000066;">round</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> - <span style="color:#0000FF;">$height</span><span style="color:#006600; font-weight:bold;">&#41;</span> / <span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">crop</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$width</span>, <span style="color:#0000FF;">$height</span>, <span style="color:#0000FF;">$x</span>, <span style="color:#0000FF;">$y</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#FF9933; font-style:italic;">//die($img-&gt;display());</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">save</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$dst</span>, <span style="color:#FF0000;">'jpeg'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#0000FF;">$img</span>-&gt;<span style="color:#006600;">free</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>这里有个相似的例子:<br />
<a href="http://www.phpx.com/happy/thread-111786-1-3.html">http://www.phpx.com/happy/thread-111786-1-3.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/166/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pear命令行参数的一些小变化</title>
		<link>http://www.ooso.net/archives/157</link>
		<comments>http://www.ooso.net/archives/157#comments</comments>
		<pubDate>Tue, 07 Mar 2006 01:50:52 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/157</guid>
		<description><![CDATA[今天在prado的开发站点上看到prado 2.1.0rc1以pear channel形式安装的办法,由此也了解到pear命令行一些新参数的用法,看下面例子:
shell> pear channel-discover http://pear.mooexpress.com
shell> pear config-set preferred_state beta
shell> pear upgrade mooexpress/prado

				<span class="readmore"><a href="http://www.ooso.net/archives/157" title="pear命令行参数的一些小变化">阅读全文（458字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天在<a href="http://www.xisc.com" target="_blank">prado</a>的开发站点上看到prado 2.1.0rc1以pear channel形式安装的办法,由此也了解到<a href="http://pear.php.net" target="_blank">pear</a>命令行一些新参数的用法,看下面例子:</p>
<blockquote><p>shell> pear channel-discover <a href="http://pear.mooexpress.com/">http://pear.mooexpress.com</a><br />
shell> pear config-set preferred_state beta<br />
shell> pear upgrade mooexpress/prado<br />
upgrade ok: channel://pear.mooexpress.com/prado-2.1 </p></blockquote>
<ul>
<li>首先用discover频道搜索: pear channel-discover <a href="http://pear.mooexpress.com/">http://pear.mooexpress.com</a></li>
<li>接着修改config允许安装beta版的pear包: pear config-set preferred_state beta</li>
<li>最后安装或升级指定的包: pear install mooexpress/prado</li>
</ul>
<p>channel参数是pear命令行最近的新增参数,估计主要为第三方的兼容pear的lib而设定.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/157/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>path方式的分页类 &#8211; Pager::Pathing()</title>
		<link>http://www.ooso.net/archives/144</link>
		<comments>http://www.ooso.net/archives/144#comments</comments>
		<pubDate>Sat, 31 Dec 2005 05:33:24 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/144</guid>
		<description><![CDATA[最近的一个项目,用path方式表现页面的url:
http://www.foo.com/index.php/p/user:photo
http://www.foo.com/index.php/p/user:photo/page/1
http://www.foo.com/index.php/p/user:photo/page/2

				<span class="readmore"><a href="http://www.ooso.net/archives/144" title="path方式的分页类 &#8211; Pager::Pathing()">阅读全文（3270字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>最近的一个项目,用path方式表现页面的url:</p>
<p><a href="http://www.foo.com/index.php/p/user:photo"><strong>http://www.foo.com/index.php/p/user:photo</strong></a><br />
<a href="http://www.foo.com/index.php/p/user:photo/page/1"><strong>http://www.foo.com/index.php/p/user:photo/page/1</strong></a><br />
<strong><a href="http://www.foo.com/index.php/p/user:photo/page/2">http://www.foo.com/index.php/p/user:photo/page/2</a></strong></p>
<p>正常的页面url:</p>
<p><strong><a href="http://www.foo.com/index.php?p=user:photo">http://www.foo.com/index.php?p=user:photo</a><br />
<a href="http://www.foo.com/index.php?p=user:photo&#038;page=1">http://www.foo.com/index.php?p=user:photo&#038;page=1</a><br />
<a href="http://www.foo.com/index.php?p=user:photo&#038;page=2">http://www.foo.com/index.php?p=user:photo&#038;page=2</a></strong></p>
<p>之前使用的分页类是<a href="http://pear.php.net/package/pager/redirected" target="_blank">Pear:Pager</a>,在这时候就玩不转了,不管如何调整参数分页链接总是错误,于是写了个Pathing.php,专门用于path方式的分页,调用方法:</p>
<div class="igBar"><span id="lphp-72"><a href="#" onclick="javascript:showCodeTxt('php-72'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-72">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager</span> = Pager::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'mode'</span> =&gt; <span style="color:#FF0000;">'Pathing'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><span id="more-144"></span></p>
<p>Pager/Pathing.php</p>
<div class="igBar"><span id="lphp-73"><a href="#" onclick="javascript:showCodeTxt('php-73'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-73">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Pager/Jumping.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Pager_Pathing extends Pager_Jumping <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp;* @see Pager_Common::_setOptions()</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> _setOptions<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$options</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$allowed_options</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'totalItems'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'perPage'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'delta'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'linkClass'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'path'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'fileName'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'append'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'httpMethod'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'importQuery'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'urlVar'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'altPrev'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'altNext'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'altPage'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'prevImg'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'nextImg'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'expanded'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'separator'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'spacesBeforeSeparator'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'spacesAfterSeparator'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'curPageLinkClassName'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'curPageSpanPre'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'curPageSpanPost'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'firstPagePre'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'firstPageText'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'firstPagePost'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'lastPagePre'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'lastPageText'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'lastPagePost'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'firstLinkTitle'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'nextLinkTitle'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'prevLinkTitle'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'lastLinkTitle'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'showAllText'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'itemData'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'clearIfVoid'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'useSessions'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'closeSession'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'sessionVar'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'pearErrorMode'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'extraVars'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'excludeVars'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'currentPage'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$options</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$key</span> =&gt; <span style="color:#0000FF;">$value</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">in_array</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$key</span>, <span style="color:#0000FF;">$allowed_options</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; <span style="color:#006600; font-weight:bold;">&#40;</span>!<span style="color:#000066;">is_null</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$value</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#FF0000;">'_'</span> . <span style="color:#0000FF;">$key</span><span style="color:#006600; font-weight:bold;">&#125;</span> = <span style="color:#0000FF;">$value</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_fileName = <span style="color:#000066;">ltrim</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_fileName, <span style="color:#FF0000;">'/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">//strip leading slash</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_path&nbsp; &nbsp; &nbsp;= <span style="color:#000066;">rtrim</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_path, <span style="color:#FF0000;">'/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//strip trailing slash</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_append<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_fileName = CURRENT_FILENAME; <span style="color:#FF9933; font-style:italic;">//avoid possible user error;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_url = <span style="color:#0000FF;">$this</span>-&gt;_path.<span style="color:#FF0000;">'/'</span>.<span style="color:#0000FF;">$this</span>-&gt;_fileName;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#FF9933; font-style:italic;">//hacked for pathing pager</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color:#0000FF;">$this</span>-&gt;_url = <span style="color:#0000FF;">$this</span>-&gt;_path;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">strncasecmp</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_fileName, <span style="color:#FF0000;">'javascript'</span>, <span style="color:#CC66CC;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> != <span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_url .= <span style="color:#FF0000;">'/'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color:#0000FF;">$len</span> = <span style="color:#000066;">strlen</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_urlVar<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">substr</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_path, -<span style="color:#0000FF;">$len</span>, <span style="color:#0000FF;">$len</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#0000FF;">$this</span>-&gt;_urlVar<span style="color:#006600; font-weight:bold;">&#41;</span> and</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">is_numeric</span><span style="color:#006600; font-weight:bold;">&#40;</span>CURRENT_FILENAME<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_url = <span style="color:#000066;">substr</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_path, <span style="color:#CC66CC;color:#800000;">0</span>, -<span style="color:#0000FF;">$len</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color:#616100;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_url.= CURRENT_FILENAME . <span style="color:#FF0000;">'/'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<span style="color:#000066;">strstr</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_fileName, <span style="color:#FF0000;">'%d'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">trigger_error</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">errorMessage</span><span style="color:#006600; font-weight:bold;">&#40;</span>ERROR_PAGER_INVALID_USAGE<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#000000; font-weight:bold;">E_USER_WARNING</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_classString = <span style="color:#FF0000;">''</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">strlen</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_linkClass<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_classString = <span style="color:#FF0000;">'class=&quot;'</span>.<span style="color:#0000FF;">$this</span>-&gt;_linkClass.<span style="color:#FF0000;">'&quot;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">strlen</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_curPageLinkClassName<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_curPageSpanPre&nbsp; = <span style="color:#FF0000;">'&lt;span class=&quot;'</span>.<span style="color:#0000FF;">$this</span>-&gt;_curPageLinkClassName.<span style="color:#FF0000;">'&quot;&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_curPageSpanPost = <span style="color:#FF0000;">'&lt;/span&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_perPage = <span style="color:#000066;">max</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_perPage, <span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">//avoid possible user errors</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_useSessions &amp;&amp; !<span style="color:#000066;">isset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_SESSION</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">session_start</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<span style="color:#000066;">empty</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$this</span>-&gt;_sessionVar<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_perPage = <span style="color:#000066;">max</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span>, <span style="color:#006600; font-weight:bold;">&#40;</span>int<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$this</span>-&gt;_sessionVar<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_useSessions<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$_SESSION</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$this</span>-&gt;_sessionVar<span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$this</span>-&gt;_perPage;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<span style="color:#000066;">empty</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_SESSION</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$this</span>-&gt;_sessionVar<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#0000FF;">$this</span>-&gt;_perPage = <span style="color:#0000FF;">$_SESSION</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$this</span>-&gt;_sessionVar<span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_closeSession<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">session_write_close</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_spacesBefore = <span style="color:#000066;">str_repeat</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">' '</span>, <span style="color:#0000FF;">$this</span>-&gt;_spacesBeforeSeparator<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_spacesAfter&nbsp; = <span style="color:#000066;">str_repeat</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">' '</span>, <span style="color:#0000FF;">$this</span>-&gt;_spacesAfterSeparator<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$request</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_httpMethod == <span style="color:#FF0000;">'POST'</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#0000FF;">$_POST</span> : <span style="color:#0000FF;">$_GET</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">isset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$request</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$this</span>-&gt;_urlVar<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; <span style="color:#000066;">empty</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$options</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'currentPage'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_currentPage = <span style="color:#006600; font-weight:bold;">&#40;</span>int<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#0000FF;">$request</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$this</span>-&gt;_urlVar<span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_currentPage = <span style="color:#000066;">max</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;_currentPage, <span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;_linkData = <span style="color:#0000FF;">$this</span>-&gt;_getLinksData<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#616100;">return</span> PAGER_OK;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>调用例子:</p>
<div class="igBar"><span id="lphp-74"><a href="#" onclick="javascript:showCodeTxt('php-74'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-74">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require</span> <span style="color:#FF0000;">'Pager/Pager.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$opt</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'mode'</span> &nbsp;&nbsp;&nbsp;=&gt; <span style="color:#FF0000;">'Pathing'</span>,&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'totalItems'</span>&nbsp; &nbsp; =&gt; <span style="color:#0000FF;">$totalItems</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'perPage'</span>&nbsp; &nbsp;&nbsp; &nbsp;=&gt; <span style="color:#0000FF;">$perPage</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'append'</span>&nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color:#000000; font-weight:bold;">false</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'fileName'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'page/%d'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'urlVar'</span>&nbsp; &nbsp; &nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'page'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$pager</span> = Pager::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$opt</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$links</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getLinks</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/144/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>轻巧的php模板类——SmartTemplate</title>
		<link>http://www.ooso.net/archives/7</link>
		<comments>http://www.ooso.net/archives/7#comments</comments>
		<pubDate>Sat, 03 Aug 2002 08:33:48 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">/?p=7</guid>
		<description><![CDATA[SmartTemplate:
一个比较轻巧的php模板，执行速度上很有优势,据说执行速度是smatry的8x倍，当然实际使用中不会那么夸张，据本人测试，运行速度至少是pear的IT模板的4倍以上(2000个循环替换)。 
下载地址：
http://www.smartphp.net/content/app/download.php

				<span class="readmore"><a href="http://www.ooso.net/archives/7" title="轻巧的php模板类——SmartTemplate">阅读全文（264字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>SmartTemplate:<br />
<br />一个比较轻巧的php模板，执行速度上很有优势,据说执行速度是smatry的8x倍，当然实际使用中不会那么夸张，据本人测试，运行速度至少是pear的IT模板的4倍以上(2000个循环替换)。 </p>
<p>下载地址：<br />
<br />http://www.smartphp.net/content/app/download.php<br />
<br />使用注意事项:<br />
<br />为了在同一个脚本中使用多个模板可以这样修改(php4):<br />
<br />281 line </p>
<div class="igBar"><span id="lphp-77"><a href="#" onclick="javascript:showCodeTxt('php-77'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-77">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">unset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_top</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>to<br />
</p>
<div class="igBar"><span id="lphp-78"><a href="#" onclick="javascript:showCodeTxt('php-78'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-78">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">unset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$GLOBALS</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'_top'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>更好的将editplus与phpCodeBeautifier结合使用</title>
		<link>http://www.ooso.net/archives/26</link>
		<comments>http://www.ooso.net/archives/26#comments</comments>
		<pubDate>Sat, 03 Aug 2002 08:33:48 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[editplus]]></category>

		<guid isPermaLink="false">/?p=26</guid>
		<description><![CDATA[phpCodeBeautifier这款php代码美化工具已经很久不见更新，它的命令行版本似乎有些bug,不能正确的将php代码弄的很整齐。但是phpCodeBeautifier的GUI版本还是能够执行正确无误的，可惜无法直接在命令行模式下打开某个文件，想与editplus结合使用比较困难。
但是注意到phpCodeBeautifier总是会打开上一次使用过的文件，打开phpCodeBeautifier.ini一看，LastFile='******'不正是我们需要的东东么？
于是俺写了如下批处理文件搞定这个问题：

				<span class="readmore"><a href="http://www.ooso.net/archives/26" title="更好的将editplus与phpCodeBeautifier结合使用">阅读全文（796字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>phpCodeBeautifier这款php代码美化工具已经很久不见更新，它的命令行版本似乎有些bug,不能正确的将php代码弄的很整齐。但是phpCodeBeautifier的GUI版本还是能够执行正确无误的，可惜无法直接在命令行模式下打开某个文件，想与editplus结合使用比较困难。<br />
<br />但是注意到phpCodeBeautifier总是会打开上一次使用过的文件，打开phpCodeBeautifier.ini一看，LastFile='******'不正是我们需要的东东么？<br />
<br />于是俺写了如下批处理文件搞定这个问题：<br />
<table border=1 cellpadding="3" cellspacing="3" style="border-collapse: collapse" bordercolor="#055AA0" width=95%>
<tr>
<td><code>代码片段:</code><br />
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="100%" class="code"><code><font color="#000000"><br />
set phpcb_path="F:Program FilesphpCB<br />set phpcb_ini=%phpcb_path%phpCodeBeautifier.ini"<br />echo [Settings]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;%phpcb_ini%<br />echo LastFile=%1&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;%phpcb_ini%<br />echo [MainForm]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;%phpcb_ini%<br />echo Left=-4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;%phpcb_ini%<br />echo Width=1032&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;%phpcb_ini%<br />echo Top=-4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;%phpcb_ini%<br />echo Height=748&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;%phpcb_ini%<br />echo [Options]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;%phpcb_ini%<br />echo FileFormat=0&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;%phpcb_ini%<br />echo Settings=PEAR&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;%phpcb_ini%</p>
<p>%phpcb_path%phpCodeBeautifier.exe</font><br />
</code></td>
</tr>
</table>
</td>
</tr>
</table>
<p>在editplus的工具配置中调用以上批处理文件，参数为$(FilePath),一切搞定，可以用phpCodeBeautifier自动打开editplus当前编辑的文件:P</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/26/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>等待pear投票的模板程序HTML_Template_Savant</title>
		<link>http://www.ooso.net/archives/35</link>
		<comments>http://www.ooso.net/archives/35#comments</comments>
		<pubDate>Sat, 03 Aug 2002 08:33:48 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">/?p=35</guid>
		<description><![CDATA[在zend.com上看到这个模板程序,咋一看结构代码都很像smarttemplate,但是细看处理方法却是截然不同,模板程序中都是直接使用的php代码,如下面这段常见的循环显示代码:
PLAIN TEXT
PHP:


				<span class="readmore"><a href="http://www.ooso.net/archives/35" title="等待pear投票的模板程序HTML_Template_Savant">阅读全文（349字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在zend.com上看到这个模板程序,咋一看结构代码都很像smarttemplate,但是细看处理方法却是截然不同,模板程序中都是直接使用的php代码,如下面这段常见的循环显示代码:</p>
<div class="igBar"><span id="lphp-80"><a href="#" onclick="javascript:showCodeTxt('php-80'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-80">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$book</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$key</span> =&gt; <span style="color:#0000FF;">$val</span><span style="color:#006600; font-weight:bold;">&#41;</span>: <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;tr&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&lt;td&gt;&lt;?php <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$val</span><span style="color:#006600; font-weight:bold;">&#91;</span>‘author’<span style="color:#006600; font-weight:bold;">&#93;</span> ?&gt;&lt;/td&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&lt;td&gt;&lt;?php <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$val</span><span style="color:#006600; font-weight:bold;">&#91;</span>‘title’<span style="color:#006600; font-weight:bold;">&#93;</span> ?&gt;&lt;/td&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/tr&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> endforeach; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>我觉得用这种方式处理比较灵活,也还方便,而且并不需要生成cache之类的把戏,因为它本身已经是php程序了.加上方便的plugin和filter扩展,值得考虑,下面是这个模板的详细信息:<br />
<br />http://pear.php.net/pepr/pepr-proposal-show.php?id=83</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/35/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>升级到php5的日记 一</title>
		<link>http://www.ooso.net/archives/90</link>
		<comments>http://www.ooso.net/archives/90#comments</comments>
		<pubDate>Sat, 03 Aug 2002 08:33:48 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">/?p=90</guid>
		<description><![CDATA[终于要从php4升级到php5了,是的,俺费尽了口舌,说服了boss使用php5和mysqli开发新项目.
首先俺细细的阅读了官方站点上介绍php5的有关章节,以及网络上的一些关于php5的文章.基本开发环境定为linux+apache2+php5+mysql4.1,很经典的搭配.为了提高开发效率,俺决定继续使用pear的类库和prado,因此现状是php4,php5的代码将并存.第一周俺们就遇到了麻烦:
1.mysqli和zend1的兼容性php.ini里面有一个选项,可以开启对zend1的兼容性,如果你在打开这个开关的同时还想使用mysqli的话,很快就会失望.它会无情的告诉你:unable clone a uncloneable object.....................

				<span class="readmore"><a href="http://www.ooso.net/archives/90" title="升级到php5的日记 一">阅读全文（504字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>终于要从php4升级到php5了,是的,俺费尽了口舌,说服了boss使用php5和mysqli开发新项目.</p>
<p>首先俺细细的阅读了官方站点上介绍php5的有关章节,以及网络上的一些关于php5的文章.基本开发环境定为linux+apache2+php5+mysql4.1,很经典的搭配.为了提高开发效率,俺决定继续使用<a href="http://pear.php.net/">pear</a>的类库和<a href="http://www.xisc.com/">prado</a>,因此现状是php4,php5的代码将并存.第一周俺们就遇到了麻烦:</p>
<p>1.mysqli和zend1的兼容性<br />php.ini里面有一个选项,可以开启对zend1的兼容性,如果你在打开这个开关的同时还想使用mysqli的话,很快就会失望.它会无情的告诉你:<br />unable clone a uncloneable object.....................</p>
<p>2.使用prado和php5的一些问题<br />prado程序包prado.php的有段代码如下:<br />set_error_handler( ........ );<br />php5的配置默认是不提示E_STRICT级别的错误,要命的是,这行代码对任何错误都会die(....................),pear的代码完全没办法工作,只好咔嚓之</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/90/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pear帮助手册的chm版</title>
		<link>http://www.ooso.net/archives/36</link>
		<comments>http://www.ooso.net/archives/36#comments</comments>
		<pubDate>Sat, 03 Aug 2002 08:33:48 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">/?p=36</guid>
		<description><![CDATA[在pear的站点上看到有chm版本的手册下载了,我想这东东以后会和php手册,mysql手册,js手册一起,常备俺的案头,时时不忘拿出来翻阅一番:
下载地址
]]></description>
			<content:encoded><![CDATA[<p>在pear的站点上看到有chm版本的手册下载了,我想这东东以后会和php手册,mysql手册,js手册一起,常备俺的案头,时时不忘拿出来翻阅一番:<br />
<br /><a href="http://pear.php.net/manual/index.php" target="_blank"><img src="/images/url.gif" border="0" alt="超链接地址" align="bottom"/>下载地址</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/36/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpCodeBeautiful与editplus结合改进</title>
		<link>http://www.ooso.net/archives/29</link>
		<comments>http://www.ooso.net/archives/29#comments</comments>
		<pubDate>Sat, 03 Aug 2002 08:33:48 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[editplus]]></category>

		<guid isPermaLink="false">/?p=29</guid>
		<description><![CDATA[有人提议使用phpCodeBeautiful的命令行，看这里：http://club.phpe.net/index.php?act=ST&#038;f=2&#038;t=3701 
在此基础上俺进行了修改,适合自己使用：
pcb.bat


				<span class="readmore"><a href="http://www.ooso.net/archives/29" title="phpCodeBeautiful与editplus结合改进">阅读全文（596字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>有人提议使用phpCodeBeautiful的命令行，看这里：<a href="http://club.phpe.net/index.php?act=ST&#038;f=2&#038;t=3701" target="_blank"><img src="/images/url.gif" border="0" alt="超链接地址" align="bottom"/>http://club.phpe.net/index.php?act=ST&#038;f=2&#038;t=3701</a> </p>
<p>在此基础上俺进行了修改,适合自己使用：<br />
<br />pcb.bat<br />
<table border=1 cellpadding="3" cellspacing="3" style="border-collapse: collapse" bordercolor="#055AA0" width=95%>
<tr>
<td><code>代码片段:</code><br />
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="100%" class="code"><code><font color="#000000"><br />
set phpcb_path="F:Program FilesphpCB"<br />%phpcb_path%phpCB.exe -space-after-if -space-after-switch -space-after-while -space-before-start-angle-bracket -space-after-end-angle-bracket -glue-amperscore -change-shell-comment-to-double-slashes-comment -force-large-php-code-tag -force-true-false-null-contant-lowercase --comment-rendering-style PEAR -align-equal-statements-to-fixed-pos -indent-with-tab -optimize-eol -align-equal-statements --padding-char-count 1 %1 &gt; %TEMP%phpcbTemp.php<br />move /Y %TEMP%phpcbTemp.php %1</font><br />
</code></td>
</tr>
</table>
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/29/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用Pear::Pager类的一个问题</title>
		<link>http://www.ooso.net/archives/87</link>
		<comments>http://www.ooso.net/archives/87#comments</comments>
		<pubDate>Sat, 03 Aug 2002 08:33:48 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">/?p=87</guid>
		<description><![CDATA[今天把公司的服务器从php4升级到php5,问题来了.最严重的是使用Pear::Pager类,报错如下:Fatal error: Cannot re-assign $this in D:xampphtdocstmptest.php on line 5
看了下Pager类的构造,有如下代码:$this = .................;
看来从php5开始不再支持这种对自身重新实例化的写法了,只好重写了Pager类草草收场
[@more@]
]]></description>
			<content:encoded><![CDATA[<p>今天把公司的服务器从php4升级到php5,问题来了.最严重的是使用Pear::Pager类,报错如下:<br /><sub><font color="#006699"><strong>Fatal error</strong>: Cannot re-assign $this in <b>D:xampphtdocstmptest.php</b> on line <b>5</b></font></sub></p>
<p>看了下Pager类的构造,有如下代码:<br /><sup><font color="#006699">$this = .................;</font></sup></p>
<p><font color="#000000">看来从php5开始不再支持这种对自身重新实例化的写法了,只好重写了Pager类草草收场</font></p>
<p>[@more@]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/87/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
