php(gd¿â£©Êä³öÖÐÎÄͼÏñµÄת»»º¯Êý
http://linux.sheup.com/linux/linux4646.htm
GB2312->UTF-8 ת»»º¯Êý
ÒÔÏÂÊÇÒ»¶Îgb2312 -> UTF-8 µÄº¯Êý£¬Î÷Î÷£¬ÎÒ³ÁË
unicode -> UTF-8 µÄËã·¨£¬ËùÒÔʵ¼Ê±ÈGB2312->unicode
û¶à¶àÉÙ¶«Î÷,Çë´ó¼Ò×¢Òâµ÷ÓÃgb2utf8()ʱ²»ÄÜÖÐÓ¢ÎÄ»ìÓÃ
³ÌÐòÐèÒªµÄGB2312.txtÎļþ
gb2utf8.php
//Program writen by sadly www.phpx.com
function gb2utf8($gb)
{
if(!trim($gb))
return $gb;
$filename="gb2312.txt";
$tmp=file($filename);
$codetable=array();
while(list($key,$value)=each($tmp))
$codetable[hexdec(substr($value,0,6))]=substr($value,7,6);
$utf8="";
while($gb)
{
if (ord(substr($gb,0,1))>127)
{
$this=substr($gb,0,2);
$gb=substr($gb,2,strlen($gb));
$utf8.=u2utf8(hexdec($codetable[hexdec(bin2hex($this))-0x8080]));
}
else
{
$gb=substr($gb,1,strlen($gb));
$utf8.=u2utf8(substr($gb,0,1));
}
}
$ret="";
for($i=0;$i $ret.=chr(substr($utf8,$i,3));
return $ret;
}
function u2utf8($c)
{
for($i=0;$i $str="";
if ($c < 0x80) {
$str.=$c;
}
else if ($c < 0x800) {
$str.=(0xC0 | $c>>6);
$str.=(0x80 | $c & 0x3F);
}
else if ($c < 0x10000) {
$str.=(0xE0 | $c>>12);
$str.=(0x80 | $c>>6 & 0x3F);
$str.=(0x80 | $c & 0x3F);
}
else if ($c < 0x200000) {
$str.=(0xF0 | $c>>18);
$str.=(0x80 | $c>>12 & 0x3F);
$str.=(0x80 | $c>>6 & 0x3F);
$str.=(0x80 | $c & 0x3F);
}
return $str;
}
?>
µ÷ÓþÙÀý:ͨ¹ýGDÊä³ö "Öйú" Á½¸öºº×Ö
example.php
//Header("Content-type: image/gif");
$im = imagecreate(400,300);
$bkg = ImageColorAllocate($im, 0,0,0);
$clr = ImageColorAllocate($im, 255,255,255);
$fnt = "d:/winnt/fonts/simhei.ttf";
include("gb2utf8.php");
$str = gb2utf8("Öйú");
ImageTTFText($im, 20, 0, 10, 20, $clr, $fnt, $str);
ImageGif($im);
ImageDestroy($im);
?>
Ïà¹ØÎĵµ£º
have been studying parsing JSON from PHP using AJAX to display it in
the client side and jQuery had been a great help to me. Here is a very
simple code in parsing JSON using jQuery that i made.
tablejsondata.php
This file makes the request to a php file and displays the returned data into a tabl ......
¡¾2010/2/4¡¿
1:
·ÅÁË6¸öÎļþÔÚcÅÌÏÂ(php.ini,php5ts.dll,libmysql.dll ,php_gd2.dll,php_mysql.dll,php_mbstring.dll ),Ò»¸öÔÚwindowsÏÂ,ÁíÎå¸öÔÚwindows/system32ÏÂ
2:
ÅäÖÃÁËpath,c:\phpºÍc:\php\ext,(²»¹ýºÃÏóûʲô×÷ÓÃ)
3:
ÃüÁî:httpd.exe -w -n "Apache2" -k start À´²é¿´ÊÇÄÄÒ»ÐеĴíÎóÐÅÏ¢.
×ܽá:µ½ÏÖÔÚ뻅 ......
Ê×ÏȽéÉÜһϴ˺¯ÊýµÄÓ÷¨£º
¶¨ÒåºÍÓ÷¨£¨php5£©
microtime() º¯Êý·µ»Øµ±Ç° Unix ʱ¼ä´ÁºÍ΢ÃëÊý¡£·µ»ØµÄ×Ö·û´®µÄ¸ñʽ£ºmsec sec
Óï·¨
microtime(get_as_float)
²ÎÊý ÃèÊö
get_as_float Èç¹û¸ø³öÁË get_as_float ²ÎÊý²¢ÇÒÆäÖµµÈ¼ÛÓÚ TRUE£¬¸Ãº¯Êý½«·µ»ØÒ»¸ö¸¡µãÊý¡£
˵Ã÷
±¾º¯Êý½öÔÚÖ§³Ö gettimeofday() ϵͳµ÷ ......
Ê×Ïȼì²éһϵݲװ°ü£º
rpm -q gd
rpm -q
jpegsrc
rpm -q libpng
rpm -q zlib
rpm -q freetype
Èç¹ûÒÔÉϵݲװ°üûÓУ¬Çë×ÔÐа²×°£¬ÆäʵҪֻҪgd ºÍlibpn Ïà¹ØµÄ°ü¼´¿É£¬ÆäËûµÄΪÁËÖ§³ÖÆäËûͼÐθñʽ¶øÒÑ¡£
£¨ÒÔϵݲװ²½ÖèΪÕûÀí×ÔÍøÂçÎÄÕ£©
1.°²×°zlib
tar zxvf zlib-1.2.2. ......