感谢sadly为我们写出了在GD中输出汉字的函数,我在使用中发现此版本输出的字符串必须为纯中文,不能夹杂英文,随修改了此bug,与大家分享。
- <?
- //Program writen by sadly www.phpfensi.com
- //modified by agun 2013/6/20
- 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);
- $ret="";
- $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]));
- for($i=0;$i<strlen($utf8);$i+=3)
- $ret.=chr(substr($utf8,$i,3));
- }
- else
- {
- $ret.=substr($gb,0,1);
- $gb=substr($gb,1,strlen($gb));
- }
- }
- return $ret;
- }
- function u2utf8($c)
- {
- for($i=0;$i<count($c);$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;
- }
- Header("Content-type: image/gif");
- $im = imagecreate(300,150);
- $bkg = ImageColorAllocate($im, 0,0,0);
- $clr = ImageColorAllocate($im, 255,255,255);
- $fnt = "c:windowsfontssimsun.ttf";
- //include("gb2utf8.php");
- $str = gb2utf8("中国agun阿棍");
- ImageTTFText($im, 30, 0, 50,50, $clr, $fnt, $str);
- ImageGif($im);
- ImageDestroy($im);
- ?>
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » 在GD中输出汉字的函数
波比源码 » 在GD中输出汉字的函数
buy generic levaquin cheap levofloxacin 250mg
dutasteride pill order dutasteride pill zofran for sale
aldactone 25mg ca valtrex 1000mg drug fluconazole 200mg brand
acillin usa cheap ampicillin 250mg erythromycin pills
sildenafil 50mg for sale buy estrace 1mg pills order estrace 1mg without prescription
lamictal 50mg tablet order vermox tretinoin cream price
order tadalafil 10mg pill voltaren 50mg over the counter brand voltaren 100mg
order isotretinoin 10mg pill order zithromax 500mg pills purchase azithromycin
order tadalafil 10mg without prescription cialis on line purchase sildenafil for sale
acheter 5mg cialis en ligne sildenafil 100mg generique en pharmacie acheter 200mg du viagra
buy deltasone pill cialis 2.5 buy viagra 100mg online cheap
tadalafil 10mg generika rezeptfrei kaufen sildenafil 200mg kaufen generika original Viagra rezeptfrei sicher kaufen
isotretinoin 40mg oral azithromycin 500mg uk ivermectin uk buy
provigil cost 5 mg cialis buy diamox 250 mg online
buy doxycycline online cheap buy clomid 100mg generic lasix 100mg oral
purchase ramipril for sale azelastine price astelin 10 ml oral
clonidine oral spiriva canada tiotropium bromide sale
cost buspar 10mg phenytoin 100 mg pill ditropan 2.5mg pill
cost alendronate 70mg order panadol 500 mg pill pepcid 20mg drug
tacrolimus 5mg tablet prograf 1mg brand buy urso 300mg for sale
imdur online order order imuran 25mg pills micardis tablet
order molnupiravir sale buy prevacid 30mg pills order prevacid generic
order zoloft 100mg generic kamagra 100mg brand sildenafil 50mg for sale
order generic imuran 100 mcg sildenafil fast shipping sildenafil 100mg tablets
order tadalafil 40mg for sale cheap tadalafil sale viagra 100mg price
order naltrexone 50mg online abilify 20mg uk order abilify 30mg online
dapsone ca adalat 10mg us perindopril pill
order provera 10mg for sale biltricide for sale online order generic periactin 4mg
order luvox 100mg generic buy fluvoxamine generic purchase glipizide generic
cheap accutane oral prednisone 20mg buy deltasone 5mg generic
piracetam ca viagra 100mg over the counter buy generic viagra 50mg
order generic zithromax 250mg zithromax 250mg for sale neurontin 600mg cheap
buy chloroquine online cheap aralen us baricitinib 4mg canada
buy metformin pills lipitor over the counter cheap tadalafil for sale
order olanzapine for sale diovan brand diovan 80mg without prescription
buy prilosec 10mg good academic writing online blackjack spins website
order metoprolol generic metoprolol 100mg uk levitra for sale online
essay helper casino gambling free poker online
buy essays for college cheap generic sildenafil viagra 50mg drug
clomid canada order clomiphene 100mg pill jackpot party casino
triamcinolone pill buy triamcinolone generic order desloratadine 5mg online
cost tadalafil 5mg buy sildenafil 100mg pills purchase viagra sale
buy cialis 20mg sale cialis usa order clopidogrel generic
buy allopurinol for sale zetia 10mg cheap buy zetia generic
methotrexate 2.5mg oral buy coumadin 5mg pill generic metoclopramide 10mg
buy baclofen 25mg online cheap buy ozobax sale purchase toradol without prescription
buy imitrex 50mg generic sumatriptan drug order avodart 0.5mg pill
spins real money online casino gambling online slots for real money
cialis pill buy ciprofloxacin without prescription order cipro 500mg sale
buy zocor generic buy zocor 10mg without prescription propecia 5mg pills
buy fluconazole 200mg without prescription generic viagra 100mg viagra order online
cephalexin canada erythromycin 500mg us erythromycin sale
tadalafil 40mg sale order cialis 20mg online cheap sildenafil 50mg uk
buy generic cefuroxime careprost cost order robaxin generic
online gambling cialis 20mg pills tadalafil canada
pay for assignments academicwriters ivermectin india