

<?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/"
	>

<channel>
	<title>银子 's 博客 &#187; 2009</title>
	<atom:link href="http://www.zdyi.com/date/2009/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zdyi.com</link>
	<description>工作手记 - No silver bullet</description>
	<pubDate>Wed, 21 Dec 2011 02:25:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>[备忘]Mysql中explain的使用详解</title>
		<link>http://www.zdyi.com/mysql-explain/510</link>
		<comments>http://www.zdyi.com/mysql-explain/510#comments</comments>
		<pubDate>Mon, 07 Dec 2009 03:26:01 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[PHP&MySql]]></category>

		<category><![CDATA[explain]]></category>

		<category><![CDATA[MySql]]></category>

		<category><![CDATA[详解]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=510</guid>
		<description><![CDATA[explain显示了mysql如何使用索引来处理select语句以及连接表.可以帮助选择更好的索引和写出更优化的查询语句.
使用方法:在select语句前加上explain.  如 EXPLAIN SELECT * FROM `users`
Explain 列的解释：
table... ]]></description>
			<content:encoded><![CDATA[<p>explain显示了mysql如何使用索引来处理select语句以及连接表.可以帮助选择更好的索引和写出更优化的查询语句.<br />
使用方法:在select语句前加上explain.  如 EXPLAIN SELECT * FROM `users`</p>
<p><strong>Explain 列的解释：</strong><br />
table 显示这一行的数据是关于哪张表的<br />
type  这是重要的列，显示连接使用了何种类型。从最好到最差的连接类型为const、eq_reg、ref、range、indexhe和ALL<br />
possible_keys 显示可能应用在这张表中的索引。如果为空，没有可能的索引。可以为相关的域从WHERE语句中选择一个合适的语句<br />
key 实际使用的索引。如果为NULL，则没有使用索引。很少的情况下，MYSQL会选择优化不足的索引。这种情况下，可以在SELECT语句中使用USE INDEX（indexname）来强制使用一个索引或者用IGNORE INDEX（indexname）来强制MYSQL忽略索引<br />
key_len 使用的索引的长度。在不损失精确性的情况下，长度越短越好<br />
ref 显示索引的哪一列被使用了，如果可能的话，是一个常数<br />
rows MYSQL认为必须检查的用来返回请求数据的行数<br />
Extra 关于MYSQL如何解析查询的额外信息。这里可以看到的坏的例子是Using temporary和Using filesort，意思MYSQL根本不能使用索引，结果是检索会很慢</p>
<p><span id="more-510"></span></p>
<p><strong>Extra 列返回的描述的意义</strong><br />
Distinct 一旦MYSQL找到了与行相联合匹配的行，就不再搜索了<br />
Not exists MYSQL优化了LEFT JOIN，一旦它找到了匹配LEFT JOIN标准的行，就不再搜索了<br />
Range checked for each<br />
Record（index map:#）没有找到理想的索引，因此对于从前面表中来的每一个行组合，MYSQL检查使用哪个索引，并用它来从表中返回行。这是使用索引的最慢的连接之一<br />
Using filesort 看到这个的时候，查询就需要优化了。MYSQL需要进行额外的步骤来发现如何对返回的行排序。它根据连接类型以及存储排序键值和匹配条件的全部行的行指针来排序全部行<br />
Using index 列数据是从仅仅使用了索引中的信息而没有读取实际的行动的表返回的，这发生在对表的全部的请求列都是同一个索引的部分的时候<br />
Using temporary 看到这个的时候，查询需要优化了。这里，MYSQL需要创建一个临时表来存储结果，这通常发生在对不同的列集进行ORDER BY上，而不是GROUP BY上<br />
Where used 使用了WHERE从句来限制哪些行将与下一张表匹配或者是返回给用户。如果不想返回表中的全部行，并且连接类型ALL或index，这就会发生，或者是查询有问题</p>
<p><strong>不同连接类型的解释（按照效率高低的顺序排序）</strong><br />
system 表只有一行：system表。这是const连接类型的特殊情况<br />
const 表中的一个记录的最大值能够匹配这个查询（索引可以是主键或惟一索引）。因为只有一行，这个值实际就是常数，因为MYSQL先读这个值然后把它当做常数来对待<br />
eq_ref 在连接中，MYSQL在查询时，从前面的表中，对每一个记录的联合都从表中读取一个记录，它在查询使用了索引为主键或惟一键的全部时使用<br />
ref 这个连接类型只有在查询使用了不是惟一或主键的键或者是这些类型的部分（比如，利用最左边前缀）时发生。对于之前的表的每一个行联合，全部记录都将从表中读出。这个类型严重依赖于根据索引匹配的记录多少—越少越好<br />
range 这个连接类型使用索引返回一个范围中的行，比如使用>或<查找东西时发生的情况<br />
index 这个连接类型对前面的表中的每一个记录联合进行完全扫描（比ALL更好，因为索引一般小于表数据）<br />
ALL 这个连接类型对于前面的每一个记录联合进行完全扫描，这一般比较糟糕，应该尽量避免 </p>
]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/mysql-explain/510/feed</wfw:commentRss>
		</item>
		<item>
		<title>[备忘]PHP简单调试</title>
		<link>http://www.zdyi.com/php-debug/508</link>
		<comments>http://www.zdyi.com/php-debug/508#comments</comments>
		<pubDate>Wed, 25 Nov 2009 03:27:36 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[PHP&MySql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[简单调试]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=508</guid>
		<description><![CDATA[还是很方便的调试方式..记录一下备忘

?View Code PHP1
2
ini_set&#40;&#34;error_log&#34;, &#34;E:\php_error.log&#34;&#41;;  
error_log&#40;$output,0&#41;;
... ]]></description>
			<content:encoded><![CDATA[<p>还是很方便的调试方式..记录一下备忘</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p508code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5082"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p508code2"><pre class="php" style="font-family:monospace;"><a href="http://www.php.net/ini_set"><span style="color: #990000;">ini_set</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;error_log&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;E:\php_error.log&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<a href="http://www.php.net/error_log"><span style="color: #990000;">error_log</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$output</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/php-debug/508/feed</wfw:commentRss>
		</item>
		<item>
		<title>php生成渐变图片</title>
		<link>http://www.zdyi.com/php-gd-image/503</link>
		<comments>http://www.zdyi.com/php-gd-image/503#comments</comments>
		<pubDate>Fri, 13 Nov 2009 02:04:27 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[PHP&MySql]]></category>

		<category><![CDATA[gd]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[图片]]></category>

		<category><![CDATA[渐变]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=503</guid>
		<description><![CDATA[问题链接：http://bbs.blueidea.com/thread-2957105-1-1.html
我是使用GD的 imagefilledrectangle 函数来实现的. 不知是否有更好的解法

?View Code PHP1
2
3
4
5
6
7
8
9
10
11
12
&#60;?php
$im = imagecreate&#40;255, 255&#41;;
$bg = imagec... ]]></description>
			<content:encoded><![CDATA[<p>问题链接：<a href="http://bbs.blueidea.com/thread-2957105-1-1.html" target="_blank">http://bbs.blueidea.com/thread-2957105-1-1.html</a></p>
<p>我是使用GD的 imagefilledrectangle 函数来实现的. 不知是否有更好的解法</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p503code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5034"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code" id="p503code4"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$im</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/imagecreate"><span style="color: #990000;">imagecreate</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$bg</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/imagecolorallocate"><span style="color: #990000;">imagecolorallocate</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">255</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&gt;=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$color</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/imagecolorallocate"><span style="color: #990000;">imagecolorallocate</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <a href="http://www.php.net/imagefilledrectangle"><span style="color: #990000;">imagefilledrectangle</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$color</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: image/png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/imagepng"><span style="color: #990000;">imagepng</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/imagedestroy"><span style="color: #990000;">imagedestroy</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/php-gd-image/503/feed</wfw:commentRss>
		</item>
		<item>
		<title>Sina App Engine 试用小记</title>
		<link>http://www.zdyi.com/sina-app-engine/491</link>
		<comments>http://www.zdyi.com/sina-app-engine/491#comments</comments>
		<pubDate>Thu, 12 Nov 2009 08:30:36 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[Other]]></category>

		<category><![CDATA[sae]]></category>

		<category><![CDATA[sina]]></category>

		<category><![CDATA[试用]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=491</guid>
		<description><![CDATA[首先扫扫盲

Sina App Engine 是由新浪在近期低调发布了基于PHP的Web应用开发和运行平台(Alpha)，致力于为广大SAE开发者提供简单高效的分布式应用环境。

据说是sina内部测试的.只有200个名额. 实在... ]]></description>
			<content:encoded><![CDATA[<p>首先扫扫盲<br />
<code><br />
<a href="http://sae.sina.com.cn" target="_blank">Sina App Engine</a> 是由新浪在近期低调发布了基于PHP的Web应用开发和运行平台(Alpha)，致力于为广大SAE开发者提供简单高效的分布式应用环境。<br />
</code></p>
<p>据说是sina内部测试的.只有200个名额. 实在是好奇. 弄到了个账号测试测试. <a href="http://bbs.blueidea.com/thread-2956594-1-1.html" target="_blank">http://bbs.blueidea.com/thread-2956594-1-1.html</a> (^_^)</p>
<p>用过之后有点失望.限制N多(phpinfo都被禁止.更不要谈别的系统函数).不过一个免费的玩意不可能太多功能.HOHO. </p>
<p>11M的memcached. mysql支持. 管理起来还算相当方便. 本想放一个punbb进行测试.无奈几次上传后都不能安装.遂放弃.上传一个N久前写的小代码(访问: <a href="http://1.silver.sinaapp.com/" target="_blank">http://1.silver.sinaapp.com/</a>). 速度还可以.当虚拟主机用了..HOHO</p>
<p>后台载图</p>
<p><a href="http://www.zdyi.com/wp-content/uploads/2009/11/sae.png" rel="lightbox" title="http://www.zdyi.com/wp-content/uploads/2009/11/sae.png"><img src="http://www.zdyi.com/wp-content/uploads/2009/11/sae.png" width="500" height="300" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/sina-app-engine/491/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP处理简单图片的颜色填充</title>
		<link>http://www.zdyi.com/image-color-fill/487</link>
		<comments>http://www.zdyi.com/image-color-fill/487#comments</comments>
		<pubDate>Thu, 12 Nov 2009 02:23:41 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[PHP&MySql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[图片]]></category>

		<category><![CDATA[颜色填充]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=487</guid>
		<description><![CDATA[原问题地址:  http://bbs.blueidea.com/viewthread.php?tid=2956421

现在有一张背景色为纯蓝色(或者红色等) 并且与照片里人物有很明显的反差色彩 的一寸单人照照片，现想把，该图片中的蓝色背景用PHP处理... ]]></description>
			<content:encoded><![CDATA[<p>原问题地址:  <a href="http://bbs.blueidea.com/viewthread.php?tid=2956421" target="_blank">http://bbs.blueidea.com/viewthread.php?tid=2956421</a></p>
<p><code><br />
现在有一张背景色为纯蓝色(或者红色等) 并且与照片里人物有很明显的反差色彩 的一寸单人照照片，现想把，该图片中的蓝色背景用PHP处理为白色。即类似于PS中，用白色填充蓝色的效果。</code></p>
<p>使用GD库的imagecolorset函数可以修改简单的索引色. 不过只能对gif与png图片有效</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p487code6'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4876"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p487code6"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://home.blueidea.com/attachment/200911/9/207382_1257738485WdvH.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$im</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/imagecreatefromstring"><span style="color: #990000;">imagecreatefromstring</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$bg</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/imagecolorat"><span style="color: #990000;">imagecolorat</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/imagecolorset"><span style="color: #990000;">imagecolorset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #000088;">$bg</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/imagepng"><span style="color: #990000;">imagepng</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/imagedestroy"><span style="color: #990000;">imagedestroy</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/image-color-fill/487/feed</wfw:commentRss>
		</item>
		<item>
		<title>[备忘]安装PHP扩展时需要同时安装的扩展列表</title>
		<link>http://www.zdyi.com/php-extension/485</link>
		<comments>http://www.zdyi.com/php-extension/485#comments</comments>
		<pubDate>Thu, 12 Nov 2009 02:18:54 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[PHP&MySql]]></category>

		<category><![CDATA[PHP扩展]]></category>

		<category><![CDATA[备忘]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=485</guid>
		<description><![CDATA[仅备忘

php_curl.dll CURL, Client URL library functions Requires: libeay32.dll, ssleay32.dll (bundled)
php_domxml.dll DOM XML functions PHP = 4.3.0 requires: iconv.dll (bundled)
php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll
gnu_get... ]]></description>
			<content:encoded><![CDATA[<p>仅备忘<br />
<code><br />
php_curl.dll CURL, Client URL library functions Requires: libeay32.dll, ssleay32.dll (bundled)<br />
php_domxml.dll DOM XML functions PHP <= 4.2.0 requires: libxml2.dll<br />
(bundled) PHP >= 4.3.0 requires: iconv.dll (bundled)<br />
php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll<br />
gnu_gettext.dll (bundled), PHP >= 4.2.3 requires libintl-1.dll,<br />
php_iconv.dll ICONV characterset conversion Requires: iconv-1.3.dll<br />
php_ingres.dll Ingres II functions Requires: Ingres II libraries<br />
php_interbase.dll InterBase functions Requires: gds32.dll (bundled)<br />
php_java.dll Java functions PHP <= 4.0.6 requires: jvm.dll (bundled)<br />
php_ldap.dll LDAP functions PHP <= 4.2.0 requires libsasl.dll(bundled),<br />
PHP >= 4.3.0 requires libeay32.dll,ssleay32.dll (bundled)<br />
php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll<br />
php_mhash.dll Mhash functions PHP >= 4.3.0 requires: libmhash.dll (bundled)<br />
php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll<br />
php_mhash.dll Mhash functions PHP >= 4.3.0 requires: libmhash.dll (bundled)<br />
php_msql.dll mSQL functions Requires: msql.dll (bundled)<br />
php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled)<br />
php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll (bundled)<br />
php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysqli.dll (bundled)<br />
php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries<br />
php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled)<br />
php_oracle.dll Oracle functions Requires: Oracle 7 client libraries<br />
php_sybase_ct.dll Sybase functions Requires: Sybase client libraries<br />
php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll (bundled)<br />
php_xslt.dll XSLT functions PHP <= 4.2.0 requires sablot.dll, expat.dll (bundled).<br />
PHP >= 4.2.1 requires sablot.dll, expat.dll, iconv.dll (bundled).<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/php-extension/485/feed</wfw:commentRss>
		</item>
		<item>
		<title>转换avatar头像函数</title>
		<link>http://www.zdyi.com/avatar-function/477</link>
		<comments>http://www.zdyi.com/avatar-function/477#comments</comments>
		<pubDate>Mon, 02 Nov 2009 15:19:03 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[PHP&MySql]]></category>

		<category><![CDATA[avatar]]></category>

		<category><![CDATA[函数]]></category>

		<category><![CDATA[头像]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=477</guid>
		<description><![CDATA[仅备忘

?View Code PHP1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * 获取 avatar 头像
 *
 * @param string $email
 * @param integer $size
 * @return string
 */
function getAvatar&#40;$email, $size = '24'&#41;
&#123;
	if &#... ]]></description>
			<content:encoded><![CDATA[<p>仅备忘</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p477code8'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4778"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code" id="p477code8"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * 获取 avatar 头像
 *
 * @param string $email
 * @param integer $size
 * @return string
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> getAvatar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$size</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'24'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/is_numeric"><span style="color: #990000;">is_numeric</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$size</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'24'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$out</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.gravatar.com/avatar/'</span> <span style="color: #339933;">.</span> <a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/strtolower"><span style="color: #990000;">strtolower</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'?s='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$size</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$avatar</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;img src='<span style="color: #006699; font-weight: bold;">{$out}</span>' class='avatar avatar-<span style="color: #006699; font-weight: bold;">{$size}</span> photo' height='<span style="color: #006699; font-weight: bold;">{$size}</span>' width='<span style="color: #006699; font-weight: bold;">{$size}</span>' alt='<span style="color: #006699; font-weight: bold;">{$email}</span>' /&gt; &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$email</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$avatar</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$email</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$avatar</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/avatar-function/477/feed</wfw:commentRss>
		</item>
		<item>
		<title>[备忘]几个不错的Flash Chart (图表)</title>
		<link>http://www.zdyi.com/flash-chart/468</link>
		<comments>http://www.zdyi.com/flash-chart/468#comments</comments>
		<pubDate>Sat, 24 Oct 2009 13:47:32 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[About]]></category>

		<category><![CDATA[chart]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[图表]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=468</guid>
		<description><![CDATA[
amCharts
AnyChart Flash Chart Component
Aurigma FlashChart
B-Line Charting Component
Corda&#8217;s PopChart
FusionCharts
Graph ZX
Open Flash Chart
PHP/SWF Charts
Rich Chart Builder
Swiff Chart
WA Dynamic Flash Charts ... ]]></description>
			<content:encoded><![CDATA[<div>
<LI><A href="http://www.amcharts.com/" target="_blank">amCharts</A><br />
<LI><A href="http://www.gold-software.com/download8629.html" target="_blank">AnyChart Flash Chart Component</A><br />
<LI><A href="http://www.aurigma.com/Products/FlashChart/" target="_blank">Aurigma FlashChart</A><br />
<LI><A href="http://www.blinex.com/" target="_blank">B-Line Charting Component</A><br />
<LI><A href="http://www.corda.com/products/popchart/" target="_blank">Corda&#8217;s PopChart</A><br />
<LI><A href="http://www.infosoftglobal.com/FusionCharts/" target="_blank">FusionCharts</A><br />
<LI><A href="http://www.graphzx.com/GraphS.htm" target="_blank">Graph ZX</A><br />
<LI><A href="http://teethgrinder.co.uk/open-flash-chart/" target="_blank">Open Flash Chart</A><br />
<LI><A href="http://www.maani.us/charts/index.php" target="_blank">PHP/SWF Charts</A><br />
<LI><A href="http://www.blue-pacific.com/products/RichChartBuilder/" target="_blank">Rich Chart Builder</A><br />
<LI><A href="http://www.globfx.com/products/swfchart/" target="_blank">Swiff Chart</A><br />
<LI><A href="http://www.webassist.com/Products/ProductDetails.asp?PID=17" target="_blank">WA Dynamic Flash Charts</A> </LI></div>
]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/flash-chart/468/feed</wfw:commentRss>
		</item>
		<item>
		<title>[备忘]PHP无法加载LDAP扩展的解决方法</title>
		<link>http://www.zdyi.com/php-ldap-load/465</link>
		<comments>http://www.zdyi.com/php-ldap-load/465#comments</comments>
		<pubDate>Tue, 20 Oct 2009 07:04:17 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[PHP&MySql]]></category>

		<category><![CDATA[ldap扩展]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[加载]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=465</guid>
		<description><![CDATA[最近的项目中需要使用域账号访问域控服务器. 要开启PHP的LDAP扩展.
打开php.ini后去掉 ;extension=php_ldap.dll 的分页.重启APACHE.
刷新页面..显示 Call to undefined function ldap_connect() 
0_o 咋回事捏? 打开PHPINF... ]]></description>
			<content:encoded><![CDATA[<p>最近的项目中需要使用域账号访问域控服务器. 要开启PHP的LDAP扩展.</p>
<p>打开php.ini后去掉 ;extension=php_ldap.dll 的分页.重启APACHE.<br />
刷新页面..显示 Call to undefined function ldap_connect() </p>
<p>0_o 咋回事捏? 打开PHPINFO发现没有 LDAP.. 说明木有加载上.. </p>
<p>最终找到解决方法:</p>
<p><code><br />
将PHP目录下的libeay32.dll和ssleay32.dll拷贝到system32目录下.重启APACHE<br />
</code></p>
<p>搞电.. (^_^)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/php-ldap-load/465/feed</wfw:commentRss>
		</item>
		<item>
		<title>将指定的数组元素排在数组最后</title>
		<link>http://www.zdyi.com/array-element-last/460</link>
		<comments>http://www.zdyi.com/array-element-last/460#comments</comments>
		<pubDate>Fri, 16 Oct 2009 01:36:20 +0000</pubDate>
		<dc:creator>银子</dc:creator>
		
		<category><![CDATA[PHP&MySql]]></category>

		<category><![CDATA[元素]]></category>

		<category><![CDATA[排列]]></category>

		<category><![CDATA[数组]]></category>

		<guid isPermaLink="false">http://www.zdyi.com/?p=460</guid>
		<description><![CDATA[原题目地址: http://bbs.blueidea.com/thread-2953135-1-1.html
我的解法是删除那个数组元素再将array_push那个元素

?View Code PHP1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
&#60;?php
function moveArrayElement&#40;&#38; $arr, $element&#41;
&... ]]></description>
			<content:encoded><![CDATA[<p>原题目地址: <a href="http://bbs.blueidea.com/thread-2953135-1-1.html" target="_blank">http://bbs.blueidea.com/thread-2953135-1-1.html</a></p>
<p>我的解法是删除那个数组元素再将array_push那个元素</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p460code11'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p46011"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p460code11"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> moveArrayElement<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span> <span style="color: #000088;">$arr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <a href="http://www.php.net/array_push"><span style="color: #990000;">array_push</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$arr</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'楼主'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'沙发'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'板凳'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'地板'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
moveArrayElement<span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'楼主'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/print_r"><span style="color: #990000;">print_r</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><span id="more-460"></span></p>
<p>想一想,这样会出现什么问题? 没错.. 如果指定$value查找会出现两个值相同的情况</p>
<p>还是指定数组下标比较合适</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p460code12'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p46012"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p460code12"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> moveArrayElement<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span> <span style="color: #000088;">$arr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$index</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$tmp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <a href="http://www.php.net/array_push"><span style="color: #990000;">array_push</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tmp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$arr</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'楼主'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'沙发'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'板凳'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'地板'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
moveArrayElement<span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/print_r"><span style="color: #990000;">print_r</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>大致没有什么问题了.. 不过对于二维数组需要用别的方式处理..懒得写了..HOHO</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zdyi.com/array-element-last/460/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

