<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[运维进行时]]></title> 
<link>https://blog.liuts.com/index.php</link> 
<description><![CDATA[互联网运维与架构]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[运维进行时]]></copyright>
<item>
<link>https://blog.liuts.com/post/178/</link>
<title><![CDATA[在线图片处理平台[原创]]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Wed, 13 Jan 2010 08:05:31 +0000</pubDate> 
<guid>https://blog.liuts.com/post/178/</guid> 
<description>
<![CDATA[ 
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;平台基于php+ImageMagick+prototype.js，实现在线图片处理。可以处理来自服务器本身、远程服务器及用户本地的图片，支持JPG、BMP、GIF、FITS、PNG、TIFF、PDF、MIFF、PSD、WBMP等几十种常用文件格式。<br/><br/><strong>在线测试</strong><br/><a href="http://webps.liuts.com" target="_blank">http://webps.liuts.com</a><br/><br/><strong>项目托管地址</strong><br/><a href="http://code.google.com/p/onlineps/" target="_blank">http://code.google.com/p/onlineps/</a><br/><br/><strong>平台界面</strong><br/><a href="https://blog.liuts.com/attachment.php?fid=56" target="_blank"><img src="https://blog.liuts.com/attachment.php?fid=56" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><strong>处理代码</strong><br/><textarea name="code" class="php" rows="15" cols="100">
<?
/*
作者：刘天斯
邮箱：liutiansi@gmail.com
最后更新：2007-01-25 10:27
BLOG：http://blog.liuts.com
功能：实现根据处理ID进行相应的图片处理；
*/

session_start();
header("Content-Type: text/html;charset=GBK");
$va=$_REQUEST[va];
$vb=$_REQUEST[vb];
$vc=$_REQUEST[vc];
$vd=$_REQUEST[vd];
$ve=$_REQUEST[ve];
$optype=$_REQUEST[optype];
$textCent=$_REQUEST[textCent];
copy("Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1],"tmp/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]);
switch ($optype) &#123;
case "1":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -mattecolor ".$ve." -frame ".$va."x".$va."+".$vb." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]);
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "2":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -resize ".$va."x".$va." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "3":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -flip Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "4":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -flop Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "5":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -raise ".$va."x".$va." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "6":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert +raise ".$va."x".$va." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case "7":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -sharpen ".$va." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;&nbsp;&nbsp;&nbsp;&nbsp;
case "8":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -monochrome Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "9":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -colorize ".$va.",".$vb.",".$vc." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "10":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -sample 10% -sample 1000% Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case "12":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -rotate ".$va." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "13":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -modulate 110,100,100 Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "14":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -modulate 90,100,100 Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case "15":
exec("/usr/local/bin/convert -modulate 100,110,100 Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "16":
exec("/usr/local/bin/convert -modulate 100,90,100 Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "17":
exec("/usr/local/bin/convert -modulate 100,100,110 Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "18":
exec("/usr/local/bin/convert -modulate 100,100,90 Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;&nbsp;&nbsp;&nbsp;&nbsp;
case "19":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." -crop ".$vc."x".$vd."+".$va."+".$vb." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "20":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -blur ".$va."x".$vb." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;&nbsp;&nbsp; 
case "21":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -noise 3 Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "22":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -paint 3 Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "23":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -charcoal ".$va." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "24":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -spread ".$va." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "25":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -swirl ".$va." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "26":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -font ./MX1GJM.TTF -fill beige -pointsize 25 -draw 'text ".$va.",".($vb+19)." &#92;"'`echo ".$textCent."&#124;iconv -f GB2312 -t UTF-8`'&#92;"' -fill royalblue&nbsp;&nbsp;-pointsize 25 -draw 'text ".($va+1).",".($vb-1+19)." &#92;"'`echo ".$textCent."&#124;iconv -f GB2312 -t UTF-8`'&#92;"' Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "28":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -colorspace gray&nbsp;&nbsp;-normalize -fill gray50 -colorize 70% Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;
case "29":
&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -wave ".$va."x".$vb." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;break;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case "":
&nbsp;&nbsp;&nbsp;&nbsp;$tmpimg=$_FILES['uploadimage']['name'];
&nbsp;&nbsp;&nbsp;&nbsp;$filebase=strtolower(strrchr($_FILES['uploadimage']['name'],"."));
&nbsp;&nbsp;&nbsp;&nbsp;if ($filebase!=".jpg" and $filebase!=".gif" and $filebase!=".png" and $filebase!=".jpeg" and $filebase!=".bmp")
&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Success="0";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$error="Ö»ÔÊÐíÉÏŽ«ÍŒÏñžñÊœÎÄŒþ£¬Èç.jpg¡¢.gif¡¢.pngµÈ¡£";
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (@move_uploaded_file($_FILES['uploadimage']['tmp_name'],"Finally/".$_SESSION['USERSESSION'][0]."/".$tmpimg))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Success="1";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$img_info = getimagesize("Finally/".$_SESSION['USERSESSION'][0]."/".$tmpimg);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exec("/usr/local/bin/convert -draw 'image Over ".$va.",".$vb.",".$img_info[0].",".$img_info[1]." Finally/".$_SESSION['USERSESSION'][0]."/".$tmpimg."' Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]." Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Success="0";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$error="ÎÄŒþÉÏŽ«Ê§°Ü£¬ÇëÓëliutiansi@gamil.comÁªÏµ¡£";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;break;
&#125;

if ($optype=="19" &#124;&#124; $optype=="26")
&#123;
&nbsp;&nbsp;echo "&#123;&#92;n";
&nbsp;&nbsp;echo "&#92;"item&#92;": [&#92;n";
&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;&#92;n";
&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#92;"result&#92;": &#92;"1&#92;",&#92;n";
&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#92;"link&#92;": &#92;"2&#92;"&#92;n";
&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#125;&#92;n";
&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]&#92;n";
&nbsp;&nbsp;echo "&#125;&#92;n";&nbsp;&nbsp;
&#125;
else if ($optype=="")
&#123;
&nbsp;&nbsp;if ($Success=="1")
&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;echo "<script language='javascript'>&#92;n";
&nbsp;&nbsp;&nbsp;&nbsp;echo "window.top.opener.document.getElementById(&#92;"Finallyimg&#92;").src='Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."?".time()."';&#92;n";
&nbsp;&nbsp;&nbsp;&nbsp;echo "top.opener=null;top.close();&#92;n";
&nbsp;&nbsp;&nbsp;&nbsp;echo "</script>&#92;n";&nbsp;&nbsp;
&nbsp;&nbsp;&#125;
&nbsp;&nbsp;else
&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;echo "<script language='javascript'>&#92;n";
&nbsp;&nbsp;&nbsp;&nbsp;echo "alert(&#92;"$error&#92;")";
&nbsp;&nbsp;&nbsp;&nbsp;echo "</script>&#92;n";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&#125;
&#125;
else
&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Finally_info=explode(" ",exec("identify Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "<img src=Finally/".$_SESSION['USERSESSION'][0]."/".$_SESSION['USERSESSION'][1]."?".time()."&nbsp;&nbsp;id=&#92;"Finallyimg&#92;" onload=&#92;"window.status='图像基本信息【文件格式：".$Finally_info[1]."　　　分辨率：".$Finally_info[2]."　　　文件大小：".round(($Finally_info[5]/1024),2)."k】
'&#92;">";
&#125;
?>
</textarea><br/><br/>如大家有什么疑问或感兴趣的话题可以通过weibo与我交流：<a href="http://t.qq.com/yorkoliu" target="_blank">http://t.qq.com/yorkoliu</a><br/>Tags - <a href="https://blog.liuts.com/tags/webps/" rel="tag">webps</a> , <a href="https://blog.liuts.com/tags/%25E5%259C%25A8%25E7%25BA%25BF/" rel="tag">在线</a> , <a href="https://blog.liuts.com/tags/%25E5%259B%25BE%25E7%259B%25B8%25E5%25A4%2584%25E7%2590%2586/" rel="tag">图相处理</a> , <a href="https://blog.liuts.com/tags/photoshop/" rel="tag">photoshop</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/166/</link>
<title><![CDATA[给php添加iconv模块]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Sat, 19 Sep 2009 16:12:18 +0000</pubDate> 
<guid>https://blog.liuts.com/post/166/</guid> 
<description>
<![CDATA[ 
	./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-iconv<br/>make时提示：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>.....................................................<br/>ext/iconv/.libs/iconv.o(.text+0x1738): In function `zif_iconv_mime_encode':<br/>/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1017: undefined reference to `libiconv_open'<br/>ext/iconv/.libs/iconv.o(.text+0x1756):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1031: undefined reference to `libiconv_open'<br/>ext/iconv/.libs/iconv.o(.text+0x1993):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1290: undefined reference to `libiconv_close'<br/>ext/iconv/.libs/iconv.o(.text+0x19ad):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1293: undefined reference to `libiconv_close'<br/>ext/iconv/.libs/iconv.o(.text+0x1b01):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1102: undefined reference to `libiconv'<br/>ext/iconv/.libs/iconv.o(.text+0x1b33):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1134: undefined reference to `libiconv'<br/>ext/iconv/.libs/iconv.o(.text+0x1b5e):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1150: undefined reference to `libiconv'<br/>ext/iconv/.libs/iconv.o(.text+0x1e10):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1202: undefined reference to `libiconv'<br/>ext/iconv/.libs/iconv.o(.text+0x1e3c):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1233: undefined reference to `libiconv'<br/>ext/iconv/.libs/iconv.o(.text+0x207f):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1277: more undefined references to `libiconv' follow<br/>ext/iconv/.libs/iconv.o(.text+0x2c08): In function `php_iconv_stream_filter_dtor':<br/>/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2393: undefined reference to `libiconv_close'<br/>ext/iconv/.libs/iconv.o(.text+0x2cf2): In function `php_iconv_stream_filter_append_bucket':<br/>/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2543: undefined reference to `libiconv'<br/>ext/iconv/.libs/iconv.o(.text+0x2d34):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2543: undefined reference to `libiconv'<br/>ext/iconv/.libs/iconv.o(.text+0x2de7):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2465: undefined reference to `libiconv'<br/>ext/iconv/.libs/iconv.o(.text+0x30e2): In function `php_iconv_stream_filter_factory_create':<br/>/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2419: undefined reference to `libiconv_open'<br/>collect2: ld returned 1 exit status<br/>make: *** [sapi/cli/php] Error 1<br/></div></div><br/><strong>解决方法</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz<br/>tar -zxvf libiconv-1.13.1.tar.gz<br/>cd libiconv-1.13.1<br/>./configure --prefix=/usr/local/libiconv<br/>make<br/>make install<br/></div></div><br/><strong>再检查php</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>#./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-iconv=/usr/local/libiconv<br/>#make<br/>#make install<br/></div></div><br/>另一种解决方法为去除iconv模块也能正常编译php，如下：<br/>編輯 Makefile 大約 77 行左右的地方:<br/>EXTRA_LIBS = ..... -lcrypt<br/>在最後加上 -liconv，例如:<br/>EXTRA_LIBS = ..... -lcrypt -liconv<br/>再运行make就可以了。<br/>Tags - <a href="https://blog.liuts.com/tags/iconv/" rel="tag">iconv</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/126/</link>
<title><![CDATA[linux下用yum给php安装gd库]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Thu, 22 May 2008 13:31:44 +0000</pubDate> 
<guid>https://blog.liuts.com/post/126/</guid> 
<description>
<![CDATA[ 
	[root@localhost ~]# yum install php-gd*<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>Setting up Install Process<br/>Setting up repositories<br/>base 100% &#124;=========================&#124; 951 B 00:00<br/>update 100% &#124;=========================&#124; 951 B 00:00<br/>================================================<br/>GD Support enabled<br/>GD Version bundled (2.0.28 compatible)<br/>FreeType Support enabled<br/>FreeType Linkage with freetype<br/>FreeType Version 2.2.1<br/>GIF Read Support enabled<br/>GIF Create Support enabled<br/>JPG Support enabled<br/>PNG Support enabled<br/>WBMP Support enabled<br/>XBM Support enabled <br/>================================================<br/></div></div><br/>好方便啊，呵呵：） <br/><br/>Tags - <a href="https://blog.liuts.com/tags/gd/" rel="tag">gd</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/115/</link>
<title><![CDATA[在XP下fast-cgi安装PHP]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Thu, 22 May 2008 13:09:12 +0000</pubDate> 
<guid>https://blog.liuts.com/post/115/</guid> 
<description>
<![CDATA[ 
	好久没有在WIN下安装WAMP环境，今天配得还真有点生，写下来做文档用：）<br/>软件包：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>apache_2.2.4-win32-x86-no_ssl.zip<br/>php-5.2.6-Win32.zip<br/>mysql-5.2.0-falcon-alpha-win32.zip<br/></div></div><br/>一、安装apache，安装目录：c:&#92;apache2.2。<br/>二、安装php，解压php-5.2.6-Win32.zip到c:&#92;php5<br/>三、安装mysql，安装目录c:&#92;mysql5<br/>四、配置apache：<br/><textarea name="code" class="c" rows="15" cols="100">
ScriptAlias /php/ "c:/php5/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi.exe"
<Directory />
&nbsp;&nbsp;&nbsp;&nbsp;Options FollowSymLinks
&nbsp;&nbsp;&nbsp;&nbsp;AllowOverride None
&nbsp;&nbsp;&nbsp;&nbsp;Order deny,allow
&nbsp;&nbsp;&nbsp;&nbsp;deny from all
&nbsp;&nbsp;&nbsp;&nbsp;Satisfy all
</Directory>
</textarea><br/>修改成：<br/><textarea name="code" class="c" rows="15" cols="100">
<Directory />
&nbsp;&nbsp;&nbsp;&nbsp;Options FollowSymLinks
&nbsp;&nbsp;&nbsp;&nbsp;AllowOverride None
&nbsp;&nbsp;&nbsp;&nbsp;Order deny,allow
&nbsp;&nbsp;&nbsp;&nbsp;allow from all
&nbsp;&nbsp;&nbsp;&nbsp;Satisfy all
</Directory>
</textarea><br/>修改php.ini<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>extension_dir = "C:&#92;php5&#92;ext"<br/>extension=php_mysql.dll<br/>extension=php_gd2.dll<br/></div></div><br/>Tags - <a href="https://blog.liuts.com/tags/php/" rel="tag">php</a> , <a href="https://blog.liuts.com/tags/fast-cgi/" rel="tag">fast-cgi</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/111/</link>
<title><![CDATA[CodeIgniterURL中去掉index.php规则]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Thu, 22 May 2008 12:53:33 +0000</pubDate> 
<guid>https://blog.liuts.com/post/111/</guid> 
<description>
<![CDATA[ 
	<strong>第一步，修改httpd.conf</strong><br/><textarea name="code" class="shell" rows="15" cols="100">
<DIRECTORY />
&nbsp;&nbsp;&nbsp;&nbsp;Options FollowSymLinks
&nbsp;&nbsp;&nbsp;&nbsp;AllowOverride None
&nbsp;&nbsp;&nbsp;&nbsp;Order deny,allow
&nbsp;&nbsp;&nbsp;&nbsp;allow from all
&nbsp;&nbsp;&nbsp;&nbsp;Satisfy all
</DIRECTORY>
</textarea><br/>修改成：<br/><textarea name="code" class="shell" rows="15" cols="100">
<DIRECTORY />
&nbsp;&nbsp;&nbsp;&nbsp;Options FollowSymLinks
&nbsp;&nbsp;&nbsp;&nbsp;AllowOverride AlL
&nbsp;&nbsp;&nbsp;&nbsp;Order deny,allow
&nbsp;&nbsp;&nbsp;&nbsp;allow from all
&nbsp;&nbsp;&nbsp;&nbsp;Satisfy all
</DIRECTORY>
</textarea><br/>作用是开启.htaccess功能。<br/>在站点目录下新建.htaccess文件(window下不能直接创建，得先在记事本编辑好再保存为.htaccess)<br/><strong>方案一</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>RewriteEngine on<br/>RewriteCond $1 !^(index&#92;.php&#124;public&#124;tmp&#124;robots&#92;.txt)<br/>RewriteRule ^(.*)$ index.php/$1 [L]<br/></div></div><br/><strong>方案二</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>RewriteEngine on<br/>RewriteOptions Inherit<br/>RewriteCond %&#123;REQUEST_FILENAME&#125; !-d<br/>RewriteCond %&#123;REQUEST_FILENAME&#125; !-f<br/>RewriteRule ^(.*)$ /index.php/$1 [L]<br/></div></div><br/>重启apache搞定。<br/>Tags - <a href="https://blog.liuts.com/tags/codeigniter/" rel="tag">codeigniter</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/110/</link>
<title><![CDATA[CodeIgniter结合Ajax编写搜索功能]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Thu, 22 May 2008 12:48:25 +0000</pubDate> 
<guid>https://blog.liuts.com/post/110/</guid> 
<description>
<![CDATA[ 
	需要prototype.js支持。<br/><strong>function_search.js</strong><br/><textarea name="code" class="javascript" rows="15" cols="100">
window.onload = function () &#123;
 new Ajax.Autocompleter("function_name", "autocomplete_choices", base_url+'application/ajaxsearch/', &#123;&#125;);
 $('function_search_form').onsubmit = function () &#123;
&nbsp;&nbsp;inline_results ();
&nbsp;&nbsp;return false; 
 &#125;
&#125;
function inline_results () &#123;
 new Ajax.Updater ("function_description", base_url+'application/ajaxsearch', &#123;method:'post', postBody:'description=true&function_name='+$F('function_name')&#125;);
 $('function_description').hide();
 new Effect.Appear('function_description');
&#125;
</textarea><br/><strong>控制器</strong><br/><textarea name="code" class="php" rows="15" cols="100">
<?php
class Application extends Controller &#123;
 function Application()
 &#123;
&nbsp;&nbsp;parent::Controller();
&nbsp;&nbsp;$this->load->model('function_model');
 &#125;
 function index()
 &#123;
&nbsp;&nbsp;$data['title'] = "Code Igniter Sample Application";
&nbsp;&nbsp;$data['extraHeadContent'] = '<script type="text/javascript" src="' . base_url() . '/js/function_search.js"></script>';
&nbsp;&nbsp;$this->load->view('application/index', $data);
 &#125;
 function ajaxsearch ()
 &#123;
&nbsp;&nbsp;$searchTerm = $this->input->post('function_name');
&nbsp;&nbsp;$description = $this->input->post('description');
&nbsp;&nbsp;echo $this->function_model->getSearchResults($searchTerm, $description);
 &#125;
 
 function search()
 &#123;
&nbsp;&nbsp;$data['title'] = "Code Igniter Sample Application Results";
&nbsp;&nbsp;$searchTerm = $this->input->post('function_name');
&nbsp;&nbsp;$data['search_results'] = $this->function_model->getSearchResults($searchTerm);
&nbsp;&nbsp;$this->load->view('application/search', $data);
 &#125;
&#125;
?>
</textarea><br/><strong>模块</strong><br/><textarea name="code" class="php" rows="15" cols="100">
<?php
class Function_model extends Model &#123;
 function Function_model()
 &#123;
&nbsp;&nbsp;parent::Model();
 &#125;
 function getSearchResults ($function_name, $descriptions = TRUE)
 &#123;
&nbsp;&nbsp;$this->db->like('function_name', $function_name);
&nbsp;&nbsp;$this->db->orderby('function_name');
&nbsp;&nbsp;$query = $this->db->get('functions');
&nbsp;&nbsp;if ($query->num_rows() > 0) &#123;
&nbsp;&nbsp; $output = '<ul>';
&nbsp;&nbsp; foreach ($query->result() as $function_info) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;if ($descriptions) &#123;
&nbsp;&nbsp;&nbsp;&nbsp; $output .= '<li><strong>' . $function_info->function_name . '</strong><br />';
&nbsp;&nbsp;&nbsp;&nbsp; $output .= $function_info->function_description . '</li>';
&nbsp;&nbsp;&nbsp;&nbsp;&#125; else &#123;
&nbsp;&nbsp;&nbsp;&nbsp; $output .= '<li>' . $function_info->function_name . '</li>';
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp; &#125;
&nbsp;&nbsp; $output .= '</ul>';
&nbsp;&nbsp; return $output;
&nbsp;&nbsp;&#125; else &#123;
&nbsp;&nbsp; return '<p>Sorry, no results returned.</p>';
&nbsp;&nbsp;&#125;
 &#125;
&#125;
?>
</textarea><br/><strong>视图</strong><br/><textarea name="code" class="php" rows="15" cols="100">
<?php
$this->load->view("header");
?>
&nbsp;&nbsp;&nbsp;&nbsp;<h2><?= $title;?></h2>
&nbsp;&nbsp;&nbsp;&nbsp;<div id="function_description"> 
&nbsp;&nbsp;<?= $search_results;?>
 </div>
<?php
$this->load->view("footer");
?>
</textarea><br/>Tags - <a href="https://blog.liuts.com/tags/codeigniter/" rel="tag">codeigniter</a> , <a href="https://blog.liuts.com/tags/prototype/" rel="tag">prototype</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/69/</link>
<title><![CDATA[一个不错的PHP框架-Symfony]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Tue, 21 Aug 2007 15:56:38 +0000</pubDate> 
<guid>https://blog.liuts.com/post/69/</guid> 
<description>
<![CDATA[ 
	什么是Symfony?<br/>Symfony是一个基于PHP5的网站框架(web framework)。<br/>&nbsp;&nbsp;&nbsp;&nbsp;根据最佳的网站编程经验，也被一些实际运作的网站验证过，Symfony能提高网站应用程式创建和维护的效率，且以强力的控制项和乐趣来取代重复性的编程工作。<br/>symfony提供了一系列无缝整合的特性，例如：<br/>&nbsp;&nbsp;&nbsp;&nbsp;*简单的样板和辅助类别<br/>&nbsp;&nbsp;&nbsp;&nbsp;*缓存管理<br/>&nbsp;&nbsp;&nbsp;&nbsp;*多种环境的支持<br/>&nbsp;&nbsp;&nbsp;&nbsp;*部署管理<br/>&nbsp;&nbsp;&nbsp;&nbsp;*智慧URLs<br/>&nbsp;&nbsp;&nbsp;&nbsp;*骨架棚架的支持（scaffolding）<br/>&nbsp;&nbsp;&nbsp;&nbsp;*多语言和国际化支持<br/>&nbsp;&nbsp;&nbsp;&nbsp;*物件模型和MVC分离<br/>&nbsp;&nbsp;&nbsp;&nbsp;*支持Ajax<br/>&nbsp;&nbsp;&nbsp;&nbsp;*可以企业级应用<br/>&nbsp;&nbsp;&nbsp;&nbsp;简单的说，Symfony是专给“懒人使用的职业级网站制作工具”。<br/>Symfony发布在MIT 的许可下, 它是完全免费的。<br/>Tags - <a href="https://blog.liuts.com/tags/php/" rel="tag">php</a> , <a href="https://blog.liuts.com/tags/symfony/" rel="tag">symfony</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/62/</link>
<title><![CDATA[PHP汉字验证码的实现]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Tue, 21 Aug 2007 15:36:14 +0000</pubDate> 
<guid>https://blog.liuts.com/post/62/</guid> 
<description>
<![CDATA[ 
	<textarea name="code" class="php" rows="15" cols="100">
<?php&nbsp;&nbsp;&nbsp;&nbsp;
/*&nbsp;&nbsp;&nbsp;&nbsp;
* 文件:chinesechar.php&nbsp;&nbsp;&nbsp;&nbsp;
* 作用:汉字数据储存&nbsp;&nbsp;&nbsp;&nbsp;
* 作者:PHP实战群:33918040 - 鱼尾唯一&nbsp;&nbsp;&nbsp;&nbsp;
* 网址:http://bbs.ailf.cn/ http://www.fishwei.com/&nbsp;&nbsp;
* 特注:版权所有转载注明出处!有付出才会有收获! 
*/&nbsp;&nbsp;&nbsp;&nbsp;
$ChineseChar = array("人","出","来","友","学","孝","仁","义","礼","廉","忠","国","中","易","白","者","火 ","土","金","木","雷","风","龙","虎","天","地",&nbsp;&nbsp; "生","晕","菜","鸟","田","三","百","钱","福 ","爱","情","兽","虫","鱼","九","网","新","度","哎","唉","啊","哦","仪","老","少","日",&nbsp;&nbsp; "月 ","星");&nbsp;&nbsp;&nbsp;&nbsp;
?>&nbsp;&nbsp;&nbsp;&nbsp;

<?php&nbsp;&nbsp;&nbsp;&nbsp;
/*&nbsp;&nbsp;&nbsp;&nbsp;
* 文件:check.php&nbsp;&nbsp;&nbsp;&nbsp;
* 作用:验证&nbsp;&nbsp;&nbsp;&nbsp;
* 作者:PHP实战群:33918040 - 鱼尾唯一&nbsp;&nbsp;&nbsp;&nbsp;
* 网址:http://bbs.ailf.cn/ http://www.fishwei.com/&nbsp;&nbsp; 
* 特注:版权所有转载注明出处!有付出才会有收获! 
*/&nbsp;&nbsp;&nbsp;&nbsp;
session_start();&nbsp;&nbsp;&nbsp;&nbsp;
$errorMSG = '';&nbsp;&nbsp;&nbsp;&nbsp;
//验证用户输入是否和验证码一致&nbsp;&nbsp;&nbsp;&nbsp;
if(!is_null($_POST['check']))&nbsp;&nbsp;&nbsp;&nbsp;
&#123;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (strcasecmp($_SESSION['code'],$_POST['code'])==0)&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$errorMSG = "<p style=&#92;"font-size:12px;color:#009900&#92;">验证成功!</p>";&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$errorMSG = "<p style=&#92;"font-size:12px;color:#FF0000&#92;">验证失败!</p>";&nbsp;&nbsp;&nbsp;&nbsp;
&#125;&nbsp;&nbsp;&nbsp;&nbsp;
?>&nbsp;&nbsp;&nbsp;&nbsp;
<html>&nbsp;&nbsp;&nbsp;&nbsp;
<head>&nbsp;&nbsp;&nbsp;&nbsp;
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">&nbsp;&nbsp;&nbsp;&nbsp;
</head>&nbsp;&nbsp;&nbsp;&nbsp;
<body>&nbsp;&nbsp;&nbsp;&nbsp;
<?php&nbsp;&nbsp;&nbsp;&nbsp;
if($errorMSG)&#123;&nbsp;&nbsp;&nbsp;&nbsp;
echo $errorMSG;&nbsp;&nbsp;&nbsp;&nbsp;
&#125;&nbsp;&nbsp;&nbsp;&nbsp;
?>&nbsp;&nbsp;&nbsp;&nbsp;
<form action=<?php echo $_SERVER['PHP_SELF']?> method=post>&nbsp;&nbsp;&nbsp;&nbsp;
请输入验证码：<input type="text" name="code" style="width:&nbsp;&nbsp;&nbsp;&nbsp;
80px"><img src="code.php">&nbsp;&nbsp;&nbsp;&nbsp;
<?php&nbsp;&nbsp;&nbsp;&nbsp;
/*&nbsp;&nbsp;&nbsp;&nbsp;
* 文件:chinesechar.php&nbsp;&nbsp;&nbsp;&nbsp;
* 作用:汉字数据储存&nbsp;&nbsp;&nbsp;&nbsp;
* 作者:PHP实战群:33918040 - 鱼尾唯一&nbsp;&nbsp;&nbsp;&nbsp;
* 网址:http://bbs.ailf.cn/ http://www.fishwei.com/&nbsp;&nbsp;
* 特注:版权所有转载注明出处!有付出才会有收获! 
*/&nbsp;&nbsp;&nbsp;&nbsp;
$ChineseChar = array("人","出","来","友","学","孝","仁","义","礼","廉","忠","国","中","易","白","者","火 ","土","金","木","雷","风","龙","虎","天","地",&nbsp;&nbsp; "生","晕","菜","鸟","田","三","百","钱","福 ","爱","情","兽","虫","鱼","九","网","新","度","哎","唉","啊","哦","仪","老","少","日",&nbsp;&nbsp; "月 ","星");&nbsp;&nbsp;&nbsp;&nbsp;
?>&nbsp;&nbsp;&nbsp;&nbsp;

<?php&nbsp;&nbsp;&nbsp;&nbsp;
/*&nbsp;&nbsp;&nbsp;&nbsp;
* 文件:check.php&nbsp;&nbsp;&nbsp;&nbsp;
* 作用:验证&nbsp;&nbsp;&nbsp;&nbsp;
* 作者:PHP实战群:33918040 - 鱼尾唯一&nbsp;&nbsp;&nbsp;&nbsp;
* 网址:http://bbs.ailf.cn/ http://www.fishwei.com/&nbsp;&nbsp; 
* 特注:版权所有转载注明出处!有付出才会有收获! 
*/&nbsp;&nbsp;&nbsp;&nbsp;
session_start();&nbsp;&nbsp;&nbsp;&nbsp;
$errorMSG = '';&nbsp;&nbsp;&nbsp;&nbsp;
//验证用户输入是否和验证码一致&nbsp;&nbsp;&nbsp;&nbsp;
if(!is_null($_POST['check']))&nbsp;&nbsp;&nbsp;&nbsp;
&#123;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (strcasecmp($_SESSION['code'],$_POST['code'])==0)&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$errorMSG = "<p style=&#92;"font-size:12px;color:#009900&#92;">验证成功!</p>";&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$errorMSG = "<p style=&#92;"font-size:12px;color:#FF0000&#92;">验证失败!</p>";&nbsp;&nbsp;&nbsp;&nbsp;
&#125;&nbsp;&nbsp;&nbsp;&nbsp;
?>&nbsp;&nbsp;&nbsp;&nbsp;
<html>&nbsp;&nbsp;&nbsp;&nbsp;
<head>&nbsp;&nbsp;&nbsp;&nbsp;
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">&nbsp;&nbsp;&nbsp;&nbsp;
</head>&nbsp;&nbsp;&nbsp;&nbsp;
<body>&nbsp;&nbsp;&nbsp;&nbsp;
<?php&nbsp;&nbsp;&nbsp;&nbsp;
if($errorMSG)&#123;&nbsp;&nbsp;&nbsp;&nbsp;
echo $errorMSG;&nbsp;&nbsp;&nbsp;&nbsp;
&#125;&nbsp;&nbsp;&nbsp;&nbsp;
?>&nbsp;&nbsp;&nbsp;&nbsp;
<form action=<?php echo $_SERVER['PHP_SELF']?> method=post>&nbsp;&nbsp;&nbsp;&nbsp;
请输入验证码：<input type="text" name="code" style="width:&nbsp;&nbsp;&nbsp;&nbsp;
80px"><img src="code.php">&nbsp;&nbsp;&nbsp;&nbsp;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="check" value="提交验证码">&nbsp;&nbsp;&nbsp;&nbsp;
</form>&nbsp;&nbsp;&nbsp;&nbsp;
</body>&nbsp;&nbsp;&nbsp;&nbsp;
</html>&nbsp;&nbsp;&nbsp;&nbsp;

<?php&nbsp;&nbsp;&nbsp;&nbsp;
/*&nbsp;&nbsp;&nbsp;&nbsp;
* 文件:code.php&nbsp;&nbsp;&nbsp;&nbsp;
* 作用:验证码生成&nbsp;&nbsp;&nbsp;&nbsp;
* 作者:PHP实战群:33918040 - 鱼尾唯一&nbsp;&nbsp;&nbsp;&nbsp;
* 网址:http://bbs.ailf.cn/ http://www.fishwei.com/&nbsp;&nbsp;&nbsp;&nbsp;
* 特注:由 没牙的草 指导 版权所有转载注明出处!有付出才会有收获!&nbsp;&nbsp;
*/&nbsp;&nbsp;&nbsp;&nbsp;
include_once("chinesechar.php");&nbsp;&nbsp;&nbsp;&nbsp;
session_start();&nbsp;&nbsp;&nbsp;&nbsp;
// 设置 content-type&nbsp;&nbsp;&nbsp;&nbsp;
header("Content-type: image/png");&nbsp;&nbsp;&nbsp;&nbsp;
// 创建图片&nbsp;&nbsp;&nbsp;&nbsp;
$im = imagecreatetruecolor(120, 30);&nbsp;&nbsp;&nbsp;&nbsp;

// 创建颜色&nbsp;&nbsp;&nbsp;&nbsp;
$fontcolor = imagecolorallocate($im, 255, 255, 255);&nbsp;&nbsp;&nbsp;&nbsp;
$bg = imagecolorallocate($im, 0, 0, 0);&nbsp;&nbsp;&nbsp;&nbsp;

// 设置文字&nbsp;&nbsp;&nbsp;&nbsp;
for($i=0;$i<4;$i++) $text .= $ChineseChar[(array_rand($ChineseChar))];&nbsp;&nbsp;&nbsp;&nbsp;

$_SESSION['code'] = $text;&nbsp;&nbsp;&nbsp;&nbsp;
// 设置字体&nbsp;&nbsp;&nbsp;&nbsp;
$font = 'simkai.ttf';&nbsp;&nbsp;&nbsp;&nbsp;

// 添加文字&nbsp;&nbsp;&nbsp;&nbsp;
imagettftext($im, 18, 0, 11, 21, $fontcolor, $font, iconv("GB2312","UTF-8",$text));&nbsp;&nbsp;&nbsp;&nbsp;

// 输出图片&nbsp;&nbsp;&nbsp;&nbsp;
imagepng($im);&nbsp;&nbsp;&nbsp;&nbsp;
imagedestroy($im);&nbsp;&nbsp;&nbsp;&nbsp;
?><br/>&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="check" value="提交验证码">&nbsp;&nbsp;&nbsp;&nbsp;
</form>&nbsp;&nbsp;&nbsp;&nbsp;
</body>&nbsp;&nbsp;&nbsp;&nbsp;
</html>&nbsp;&nbsp;&nbsp;&nbsp;

<?php&nbsp;&nbsp;&nbsp;&nbsp;
/*&nbsp;&nbsp;&nbsp;&nbsp;
* 文件:code.php&nbsp;&nbsp;&nbsp;&nbsp;
* 作用:验证码生成&nbsp;&nbsp;&nbsp;&nbsp;
* 作者:PHP实战群:33918040 - 鱼尾唯一&nbsp;&nbsp;&nbsp;&nbsp;
* 网址:http://bbs.ailf.cn/ http://www.fishwei.com/&nbsp;&nbsp;&nbsp;&nbsp;
* 特注:由 没牙的草 指导 版权所有转载注明出处!有付出才会有收获!&nbsp;&nbsp;
*/&nbsp;&nbsp;&nbsp;&nbsp;
include_once("chinesechar.php");&nbsp;&nbsp;&nbsp;&nbsp;
session_start();&nbsp;&nbsp;&nbsp;&nbsp;
// 设置 content-type&nbsp;&nbsp;&nbsp;&nbsp;
header("Content-type: image/png");&nbsp;&nbsp;&nbsp;&nbsp;
// 创建图片&nbsp;&nbsp;&nbsp;&nbsp;
$im = imagecreatetruecolor(120, 30);&nbsp;&nbsp;&nbsp;&nbsp;

// 创建颜色&nbsp;&nbsp;&nbsp;&nbsp;
$fontcolor = imagecolorallocate($im, 255, 255, 255);&nbsp;&nbsp;&nbsp;&nbsp;
$bg = imagecolorallocate($im, 0, 0, 0);&nbsp;&nbsp;&nbsp;&nbsp;

// 设置文字&nbsp;&nbsp;&nbsp;&nbsp;
for($i=0;$i<4;$i++) $text .= $ChineseChar[(array_rand($ChineseChar))];&nbsp;&nbsp;&nbsp;&nbsp;

$_SESSION['code'] = $text;&nbsp;&nbsp;&nbsp;&nbsp;
// 设置字体&nbsp;&nbsp;&nbsp;&nbsp;
$font = 'simkai.ttf';&nbsp;&nbsp;&nbsp;&nbsp;

// 添加文字&nbsp;&nbsp;&nbsp;&nbsp;
imagettftext($im, 18, 0, 11, 21, $fontcolor, $font, iconv("GB2312","UTF-8",$text));&nbsp;&nbsp;&nbsp;&nbsp;

// 输出图片&nbsp;&nbsp;&nbsp;&nbsp;
imagepng($im);&nbsp;&nbsp;&nbsp;&nbsp;
imagedestroy($im);&nbsp;&nbsp;&nbsp;&nbsp;
?>
</textarea><br/>Tags - <a href="https://blog.liuts.com/tags/php/" rel="tag">php</a> , <a href="https://blog.liuts.com/tags/%25E9%25AA%258C%25E8%25AF%2581%25E7%25A0%2581/" rel="tag">验证码</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/60/</link>
<title><![CDATA[如何用imagemagick在图片上写中文]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Tue, 21 Aug 2007 15:29:54 +0000</pubDate> 
<guid>https://blog.liuts.com/post/60/</guid> 
<description>
<![CDATA[ 
	如何用imagemagick在图片上写中文？在帮助文档中找到的最简单的例子：<br/>convert -background lightblue -fill blue &#92;<br/>-font SimSun -pointsize 48 label:@chinese_words.utf8 &#92;<br/>label_utf8.gif<br/>需要把中文或多字节文字以utf-8编码写在chinese_words.utf8中，就可以用convert命令在图片上画出中文来。也可以直接在命令行中写中文，但是必须是utf-8编码，如：<br/>convert -background lightblue -fill blue &#92;<br/>-font SimSun -pointsize 48 label:’某人的栖息地’ &#92;<br/>label_utf8.gif<br/>最后还要注意的是，-font参数后面必须是中文字体，可以是中文字体文件的绝对路径。<br/>个人实验通过:<br/>1、/usr/bin/convert -font /www/client/webps/simsun.ttc -fill Black -draw 'text 20,29 "'`echo 中国人&#124;iconv -f GB2312 -t UTF-8`'"' -fill White -draw 'text 30,39 "'`echo 中国人&#124;iconv -f GB2312 -t UTF-8`'"' center.jpg logo.jpg<br/><br/>2、/usr/bin/convert -font /www/client/webps/simsun.ttc &#92; <br/>-fill white -pointsize 24 &#92; <br/>-draw 'text 10,20 "'`echo 我的照片&#124;iconv -f GB2312 -t UTF-8`'"' &#92; <br/>mypic.jpg mypic-with-comment.jpg <br/><br/>imagemagick参考文档<br/><a href="http://www.imagemagick.org/Usage/text/" target="_blank">http://www.imagemagick.org/Usage/text/</a><br/>Tags - <a href="https://blog.liuts.com/tags/imagemagick/" rel="tag">imagemagick</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/47/</link>
<title><![CDATA[PHP Try-catch 语句]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Tue, 21 Aug 2007 13:35:18 +0000</pubDate> 
<guid>https://blog.liuts.com/post/47/</guid> 
<description>
<![CDATA[ 
	PHP Try-catch 语句<br/>为了进一步处理异常，我们需要使用try-catch语句----包括Try语句和至少一个的catch语句。任何调用 可能抛出异常的方法的代码都应该使用try语句。Catch语句用来处理可能抛出的异常。以下显示了我们处理getCommandObject()抛出的异常的方法： <br/><textarea name="code" class="php" rows="15" cols="100">
<?php 
try &#123; 
&nbsp;&nbsp;&nbsp;&nbsp;$mgr = new CommandManager(); 
&nbsp;&nbsp;&nbsp;&nbsp;$cmd = $mgr->getCommandObject("realcommand"); 
&nbsp;&nbsp;&nbsp;&nbsp;$cmd->execute(); 
&#125; catch (Exception $e) &#123; 
&nbsp;&nbsp;&nbsp;&nbsp;print $e->getMessage(); 
&nbsp;&nbsp;&nbsp;&nbsp;exit(); 
&#125; 
?>
</textarea><br/>可以看到，通过结合使用throw关键字和try-catch语句，我们可以避免错误标记“污染”类方法返回的值。因为“异常”本身就是一种与其它任何对象不同的PHP内建的类型，不会产生混淆。 <br/><br/>如果抛出了一个异常，try语句中的脚本将会停止执行，然后马上转向执行catch语句中的脚本。 <br/><br/>如果异常抛出了却没有被捕捉到，就会产生一个fatal error。 <br/>
]]>
</description>
</item>
</channel>
</rss>