php jquery ajax中文乱码

date:星期二, 三月 16th, 2010 at 4:12 下午 Categories:php

PHP发送中文、Ajax接收
只需在php顶部加入一句:

header('Content-type: text/html;charset=GB2312');

xmlHttp会正确解析其中的中文。

Ajax发送中文、PHP接收
这个比较复杂:
Ajax中先用encodeURIComponent对要提交的中文进行编码
PHP中:

$view=iconv( 'UTF-8', 'gb2312//IGNORE' , $_POST['view']);

5 Responses to “php jquery ajax中文乱码”

  1. Superman CostumeNo Gravatar

    Hello there, simply turned into aware of your blog thru Google, and found that it is really informative. I?m gonna watch out for brussels. I will appreciate if you continue this in future. A lot of other folks will be benefited from your writing. Cheers!

    [Reply]

  2. stem cell research articlesNo Gravatar

    Hello there, just was alert to your weblog via Google, and located that it’s truly informative. I?m going to watch out for brussels. I will be grateful for those who continue this in future. Lots of folks will likely be benefited out of your writing. Cheers!

    [Reply]

  3. Cleansing Detox Diet

    Cleansing Detox Diet…

    [...]php jquery ajax中文乱码[...]…

  4. food processorreviews reviews

    best food processorreviews…

    [...]php jquery ajax中文乱码[...]…

  5. ugg boots clearance| ugg clearance| ugg boots uk| uk ugg outlet| UGG Classic Tall Boots|UGG Bailey Button Boots|UGG Kensington Boots|UGG Seline Boots

    ugg boots clearance| ugg clearance| ugg boots uk| uk ugg outlet| UGG Classic Tall Boots|UGG Bailey Button Boots|UGG Kensington Boots|UGG Seline Boots…

    [...]php jquery ajax中文乱码[...]…

Leave a Reply