PHP中文乱码问题及解决方法

  1. <html> 
  2. <head> 
  3. <title></title> 
  4. </head> 
  5. <body> 
  6. <?php 
  7. $mysql_server_name='localhost'
  8. $mysql_username='root'
  9. $mysql_password='000000'
  10. $mysql_database='lib'
  11. $conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password,$mysql_database); 
  12. $sql="select name,age from mytb"
  13. print($conn); 
  14. $rs=mysql_db_query("lib","select * from mytb",$conn); 
  15. print("n<br>"); 
  16. while($row = mysql_fetch_object($rs)){ 
  17. print ($row->name.":".$row->age."<br>"); 
  18. mysql_close($conn); 
  19. ?> 
 
显示如下:
 
  1. Resource id #1 
  2. dd:54 
  3. ddd:8 
  4. ??:15 
  5. ???:25 
  6. ??:32 
mysql编码:utf8,GBK都试过了。mysql font 和命令行显示都正确。

问题补充,乱码:

  1. ???:15 
  2. ???:25 
  3. ??:32 
这几行,数据库里的值是汉字.显示出来的是问号.解决办法,找到如下代码:
 
  1. $rs=mysql_db_query("lib","select * from mytb",$conn); 
前面加上
 
  1. mysql_query("set names gb2312"); //或者下面语句
  2. mysql_query("set names gbk"); 
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!

波比源码 » PHP中文乱码问题及解决方法

191 评论

  1. buy avodart 0.5mg flomax oral zofran drug

  2. buy altace 5mg without prescription astelin order cheap astelin

  3. purchase tacrolimus generic urso online urso generic

  4. zoloft 100mg price Buy cheap viagra cheap viagra without prescription

  5. omeprazole 20mg usa edit letter online casino real money paypal

  6. baclofen over the counter tizanidine us toradol medication

  7. metronidazole 200mg uk flagyl for sale order bactrim 960mg pill

  8. buy cephalexin 250mg generic buy cleocin 300mg order erythromycin 250mg generic

  9. order retin gel for sale avanafil canada order avanafil 100mg without prescription

  10. empire city casino online free slots online casino slots no download

  11. parx casino online blackjack game help with writing a paper

  12. order ramipril 10mg without prescription buy altace generic buy etoricoxib 120mg online cheap

  13. buy amoxil online amoxil pill ivermectin tablet

  14. minocin without prescription minocin 50mg usa order terazosin for sale

  15. oxybutynin medication cheap trileptal order oxcarbazepine generic

  16. plavix 75mg over the counter brand plavix 75mg buy nizoral 200mg online

  17. duloxetine tablet piracetam ca buy piracetam 800mg online

  18. order amoxicillin without prescription how to buy trimox buy clarithromycin 500mg generic

  19. buy sildenafil 50mg aurogra us sildalis price

  20. buy isotretinoin 10mg online amoxil price buy zithromax no prescription

  21. pseudoephedrine and fluoxetine 60 mg fluoxetine what is prozac prescribed for

  22. buy tadalafil 40mg generic viagra order cialis online buy

  23. vardenafil 10mg cheap order plaquenil generic hydroxychloroquine

  24. purchase carvedilol without prescription cenforce online buy buy chloroquine pill

  25. order toradol 10mg online cheap ketorolac us inderal order online

  26. azithromycin 250 azithromycin dog can i take azithromycin for sinus infection

  27. how quickly does azithromycin work for sinus infection https://azithromycinikm.com/ how long does it take to cure gonorrhea with azithromycin

  28. dapsone 100 mg uk cost nifedipine buy perindopril 8mg generic

  29. buy oxcarbazepine 600mg for sale order urso 300mg actigall 150mg for sale

  30. dexamethasone online buy zyvox buy nateglinide online

评论已关闭

Hi, 如果你对这款模板有疑问,可以跟我联系哦!

联系站长
赞助VIP 享更多特权,建议使用 QQ 登录
喜欢我嘛?喜欢就按“ctrl+D”收藏我吧!♡