Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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);
?>


Ïà¹ØÎĵµ£º

½â¾öPHPÖÐÎÄÂÒÂëÎÊÌâ

Ò»£®Ê×ÏÈÊÇPHP ÍøÒ³µÄ±àÂë
1.phpÎļþ±¾ÉíµÄ±àÂëÓëÍøÒ³µÄ±àÂëӦƥÅä
a. Èç¹ûÓûʹÓÃgb2312±àÂ룬ÄÇôphpÒªÊä³öÍ·£ºheader(“Content-Type: text/html; charset=gb2312")£¬¾²Ì¬Ò³ÃæÌí¼Ó<meta http-equiv="Content-Type" content="text/html; charset=gb2312">£¬ËùÓÐÎļþµÄ±àÂë¸ñʽΪANS ......

php¼Ç¼

¡¾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 À´²é¿´ÊÇÄÄÒ»ÐеĴíÎóÐÅÏ¢.
×ܽá:µ½ÏÖÔÚ뻅 ......

windows 7 ϰ²×°apache php ºÍmysqlµÄһЩÎÊÌâ¡£

ÔÚwindowsϰ²×°ampÍøÉϵĽéÉܺܶàÁË¡£
ÎÒÕâÀïֻ˵Щ¹Ø¼üµÄ²¿·Ö£¬Ò»·½Ãæ×÷Ϊ±Ê¼Ç£¬ÁíÒ»·½ÃæºÍ´ó¼Ò¹²Ïí¡£
1.°²×°apache
   a.ÕâÀïҪעÒ⣬ÔÚ¸Õ¿ªÊ¼ÌîдÖ÷»úÓòÃûʱ£¬Èç¹ûÄãûÓÐÓòÃû£¬¾ÍÔÚ±¾µØ°²×°£¬ÄǾÍÌîд±¾»úipÐÐÁË¡££¨ÎÒ¾õµÃÌîд127.0.0.1¸üºÃ£¬¾ßÌåÎÒûÊÔ¹ý£©
   b.apache µÄĬÈ϶˿ÚÊÇ80£¬ÎÒµÄ ......

php×¢Êͱê×¼

4.1 ¿é×¢ÊÍ
¿é×¢ÊÍͨ³£ÓÃÓÚÌṩ¶ÔÎļþ£¬·½·¨£¬Êý¾Ý½á¹¹ºÍËã·¨µÄÃèÊö¡£¿é×¢Êͱ»ÖÃÓÚÿ¸öÎļþµÄ¿ªÊ¼´¦ÒÔ¼°Ã¿¸ö·½·¨Ö®Ç°¡£ËüÃÇÒ²¿ÉÒÔ±»ÓÃÓÚÆäËûµØ·½£¬±ÈÈç·½·¨ÄÚ²¿¡£ÔÚ¹¦Äܺͷ½·¨ÄÚ²¿µÄ¿é×¢ÊÍÓ¦¸ÃºÍËüÃÇËùÃèÊöµÄ´úÂë¾ßÓÐÒ»ÑùµÄËõ½ø¸ñʽ¡£
¿é×¢ÊÍÖ®Ê×Ó¦¸ÃÓÐÒ»¸ö¿ÕÐУ¬ÓÃÓÚ°Ñ¿é×¢ÊͺʹúÂë·Ö¸î¿ªÀ´£¬±ÈÈ磺
/*
* ÕâÀïÊÇ¿é×¢ÊÍ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ