中文在php开发中经常会有意无意的碰到问题,今天我们来看看json_encode中文乱码的解决办法吧,虽然方法不是很好,但可以解决问题,问题的实例代码如下:
- <?php
- $arr = array
- (
- 'Name'=>'希亚',
- 'Age'=>20
- );
- $jsonencode = json_encode($arr);
- echo $jsonencode;
- ?>
结果如下:{"Name":null,"Age":20},中文成了空,那是什么原因呢,下面接着看,我们来测试utf-8,代码如下:
- <?php
- $array = array
- (
- 'title'=>iconv('gb2312','utf-8','这里是中文标题'),
- 'body'=>'abcd…'
- );
- echo json_encode($array);
- ?>
结果:{"title":"u8fd9u91ccu662fu4e2du6587u6807u9898","body":"abcd…"}
也不是我们想的东西,那我们利用php urlencode()函数处理以下,在json_encode之前,把所有数组内所有内容都用urlencode()处理一下,这样中文就没有问题了哦。
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » php json_encode中文乱码解决办法
波比源码 » php json_encode中文乱码解决办法
order levofloxacin 250mg without prescription generic levofloxacin 500mg
purchase avodart pills buy celecoxib 100mg generic buy ondansetron 4mg pill
aldactone 100mg oral valtrex 500mg canada diflucan 100mg drug
acillin ca order ampicillin 500mg online cheap erythromycin 250mg sale
sildenafil 50mg sale order nolvadex 10mg generic robaxin 500mg ca
sildenafil canada sildalis over the counter estradiol usa
lamictal 50mg tablet order prazosin online cheap tretinoin cheap
buy tadalafil brand avana voltaren 100mg us
accutane 40mg tablet buy generic amoxil 250mg order azithromycin 500mg generic
buy indomethacin 75mg generic suprax canada cost trimox 250mg
arimidex 1 mg generic Pfizer viagra canada sildenafil uk
acheter 10mg tadalafil en ligne acheter 5mg tadalafil en ligne sildenafil 100mg prix
prednisone 5mg over the counter buy deltasone 10mg pills buy viagra online cheap
cialis 10mg bestellen original viagra 50mg rezeptfrei sicher kaufen sildenafil 100mg bestellen
purchase isotretinoin for sale stromectol 12mg ca ivermectin 1mg
order doxycycline 200mg sale doxycycline for sale online cheap furosemide
ramipril 5mg cost order azelastine 10 ml online cheap order azelastine 10 ml online
order generic catapres 0.1mg meclizine 25 mg uk tiotropium bromide online order
buy hytrin terazosin 1mg oral brand sulfasalazine 500mg
alendronate canada pepcid 40mg uk pepcid price
buy prograf 1mg without prescription buy ropinirole 1mg sale ursodiol for sale online
zyban 150mg canada zyban pills seroquel 100mg oral
order molnunat pill naprosyn us lansoprazole 30mg drug
order sertraline 50mg sale lexapro 20mg cheap viagra on line
buy imuran viagra australia order viagra generic
buy cialis 10mg sale tadalafil for sale order viagra 50mg pills
naltrexone generic albendazole 400 mg over the counter order abilify 30mg without prescription
buy avlosulfon sale allegra 180mg brand buy aceon 8mg
purchase provera sale order provera 5mg sale order periactin 4 mg sale
modafinil online modafinil order ivermectin order online
luvox 100mg uk purchase ketoconazole sale order generic glucotrol 5mg
cheap accutane 40mg amoxicillin 250mg pill brand deltasone 10mg
order nootropil 800 mg online nootropil generic viagra overnight
azithromycin generic gabapentin order buy gabapentin 800mg generic
cheap cialis pill cialis 5mg without prescription sildenafil 100mg oral
buy lasix 100mg doxycycline ca hydroxychloroquine 200mg for sale
order cialis 5mg clomipramine 50mg cheap anafranil 50mg sale
order chloroquine 250mg generic purchase olumiant online cheap olumiant pill
order itraconazole order progesterone 200mg generic generic tinidazole 500mg
olanzapine 10mg usa valsartan usa generic diovan
norvasc 5mg cheap sildenafil for sale cialis coupon
prilosec online prilosec 10mg tablet free spins no deposit required
buy metoprolol without prescription order metoprolol 100mg for sale levitra online
buy term papers online real casino games best online casino
clomid sale online poker free spins no deposit required
cialis 40mg tablet buy viagra 50mg online order viagra 50mg online
priligy 60mg uk levothyroxine over the counter buy synthroid 100mcg sale
tadalafil pill cialis coupon viagra 100mg pills for men
xenical 60mg usa orlistat 60mg without prescription zovirax order
cialis otc cialis 40mg over the counter buy clopidogrel 150mg pill
buy zyloprim sale rosuvastatin order buy ezetimibe online cheap
methotrexate 5mg pill methotrexate cheap metoclopramide 10mg over the counter
domperidone oral cyclobenzaprine pills order cyclobenzaprine generic
purchase cozaar generic nexium 40mg tablet order topamax 200mg pill
baclofen cost purchase tizanidine without prescription ketorolac us
imitrex oral avodart 0.5mg drug order dutasteride for sale
buy zantac 300mg for sale order celebrex 200mg generic celebrex pills
free slot play no deposit free spins poker online for real money
buy tamsulosin generic purchase ondansetron order spironolactone pills
female cialis order tadalafil 40mg order ciprofloxacin 1000mg pill
simvastatin 10mg price brand proscar 1mg order proscar 1mg online cheap
metronidazole order online sulfamethoxazole cost buy bactrim 960mg sale
cefuroxime 250mg oral purchase ceftin for sale robaxin 500mg generic