Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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);
?>


Ïà¹ØÎĵµ£º

Parsing JSON Data from PHP Using jQuery (ajax)

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 ......

CakePHP:php¿ò¼ÜϵÁÐÖ®¿ìËÙµÄCakePHP


CakePHPÊÇÒ»¸ö·Ç³£Ñ¸ËÙPHP¿ò¼Ü£¬ÓÐЧËõ¶Ì¿ª·¢ÖÜÆÚ£¬Äܹ»Áé»îµÄ¼Ü¹¹£¬¿ª·¢£¬Î¬»¤ºÍ²¿ÊðµÄÓ¦ÓóÌÐò¡£Ëü²ÉÓÃÏñMVCÓëORMÒ»ÑùµÄÉè¼ÆÄ£Ê½£¬ÓÐÖúÓÚ½µµÍ¿ª·¢·ÑÓ㬲»ÐèÒª¿ª·¢ÈËÔ±±àдÁËÌ«¶à´úÂë¡£CakePHPÓµÓкܶà´ó¿Í»§£¬±ÈÈ磺MozillaµÄAddons£¬ÃÀ¹úÂéÊ¡Àí¹¤Ñ§ÔºµÄScratch£¬Ò®Â³´óѧµÄÿÈÕÐÂÎÅ¡£
ÍÆ¼öÖ¸Êý£º6ÐǼ¶
ѧϰ³É±¾£ºÒ» ......

PHPÖÐmicrotime()º¯Êý ÄÏÈý·½

Ê×ÏȽéÉÜһϴ˺¯ÊýµÄÓ÷¨£º
¶¨ÒåºÍÓ÷¨£¨php5£©
microtime() º¯Êý·µ»Øµ±Ç° Unix ʱ¼ä´ÁºÍ΢ÃëÊý¡£·µ»ØµÄ×Ö·û´®µÄ¸ñʽ£ºmsec sec
Óï·¨
microtime(get_as_float)
²ÎÊý ÃèÊö
get_as_float Èç¹û¸ø³öÁË get_as_float ²ÎÊý²¢ÇÒÆäÖµµÈ¼ÛÓÚ TRUE£¬¸Ãº¯Êý½«·µ»ØÒ»¸ö¸¡µãÊý¡£
˵Ã÷
±¾º¯Êý½öÔÚÖ§³Ö gettimeofday() ϵͳµ÷ ......

php ÖÐ Cookie Ïê½â

1.ÓÃ;:
        ·þÎñÆ÷¿ÉÒÔÀûÓÃCookies°üº¬ÐÅÏ¢µÄÈÎÒâÐÔÀ´É¸Ñ¡²¢¾­³£ÐÔά»¤ÕâЩÐÅÏ¢£¬ÒÔÅжÏÔÚHTTP´«ÊäÖеÄ״̬¡£Cookies×îµäÐ͵ÄÓ¦ÓÃÊÇÅж¨×¢²áÓû§ÊÇ·ñÒѾ­µÇÂ¼ÍøÕ¾£¬Óû§¿ÉÄÜ»áµÃµ½Ìáʾ£¬ÊÇ·ñÔÚÏÂÒ»´Î½øÈë´ËÍøÕ¾Ê±±£ÁôÓû§ÐÅÏ¢ÒÔ±ã¼ò»¯µÇ¼ÊÖÐø£¬ÕâЩ¶¼ÊÇCookiesµÄ¹¦Óá£ÁíÒ»¸öÖØÒ ......

ÓÃPHPÉú³ÉÑéÖ¤Âë¿ÉÒÔ½øÐеã»÷Ë¢ÐÂ

ÑéÖ¤ÂëµÄ´óÖÂÔ­ÀíÊÇÕâÑùµÄ£¬Ê×ÏÈÉú³ÉÒ»¸öËæ»úÊý£¬È»ºóÔÚÊý¾ÝÊýÉÏÃæ¼ÓÉϸÉÈÅͼƬ£¬Í¬Ê±°Ñ¸ÃÊý¾ÝÉú³ÉͼƬ²¢Êä³ö¡£
Õâ¸öÊý¾Ý±£´æÔÚsessionÖС£È»ºó°ÑÓû§µÄÊäÈëÓë±£´æÔÚsessionÖеÄÊý¾Ý½øÐÐÆ¥Å䣬½øÐÐÑéÖ¤¡£
verifyCode.php´úÂëÈçÏ£º
<?php
Header("Content-type: image/PNG");
session_start();
//× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ