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

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

PHPÈëÃÅÖ¸µ¼£ºÈçºÎѧϰPHP£¿

ÿ¸öÈ˵Äѧϰ·½Ê½²»Í¬£¬Ð´ÕâÆªÎÄÕµÄÄ¿µÄÊÇ·ÖÏíÒ»ÏÂ×Ô¼ºµÄѧϰ¹ý³Ì£¬½ö¹©²Î¿¼£¬²»ÒªÒ»Î¶µÄÓñðÈ˵Äѧϰ·½·¨£¬ÕÒ¶Ô×Ô¼ºÓÐÓõÄѧϰ·½Ê½
¾­³£ÔÚijЩÂÛ̳ºÍQQȺÀï¿´µ½Ò»Ð©ÅóÓÑ»áÎÊ“ÔõÑù²ÅÄÜѧºÃPHP£¬ÔõÑù²ÅÄÜѧºÃ***ÓïÑÔ ”£¬µ«±ðÈ˻شð×î¶àµÄÊÇ£º´Ó×òµ¥”µÄ¿ªÊ¼¡£
Õâ¸ö¼òµ¥Ò²ÐíÕæµÄ²»¼òµ¥£¬ºÇºÇ¡£Ï ......

·ÖÏíÒ»¸öPHP·ÖÒ³´úÂë

<?php
//µ÷ÊÔÊä³öÐÅÏ¢
$pageCount=15;
for($i=1;$i<=$pageCount;$i++){
dump(GetPageRange($i,$pageCount),$i);
}
//$currentPage µ±Ç°Ò³Âë
//$pageCount ×ÜÒ³Êý
//$leftSize ×ó²àÒ³Â뷶Χ
//$rightSize ÓÒ²àÒ³Â뷶Χ
//·µ»ØÒ³ÂëÇø¼äÊý×é
function GetPageRange($currentPage,$pageCount,$leftSize=3, ......

php ÖÐ Cookie Ïê½â

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

PHP Ö§³Ö»­Í¼º¯ÊýµÄ±àÒë·½·¨

Ê×Ïȼì²éһϵݲװ°ü£º
 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. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ