日期:2014-05-16 浏览次数:20533 次
<html> <html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8"/></head>
<?php
$str=isset($_POST["text"]) ? filter_input(INPUT_POST,"text",FILTER_SANITIZE_SPECIAL_CHARS) : '';
print "$str=".$str."\n";
if (strlen($str)>0){
//$str=mb_convert_encoding($str,"GBK","UTF-8");
$jo=json_decode($str); //中文的,转出来是null
print_r("\n++++\n".$jo."\n====\n");
$msg_id=$jo->msg_id; //这里就会报错了。
}
echo ' <form method="post" action="t1.php">';
echo ' <textarea name="text" rows="2" cols="80">{"name":"test","id":0,"txt":"中文"}</textarea><br>';
echo ' <input type="submit"></form>';
?>