$a=mysql_query("SELECT * FROM `qq` WHERE userid='$userid'");
$id= 1;
while($row=mysql_fetch_array($a)){
$name = file_get_contents("http://zx.52reso.com/pznc.php?id=2224503435");
$user =新しい User();
$user->id = $id++;
$user->qq = $row["qq"];
$user->txUrl ='http://q.qlogo.cn/headimg_dl?dst_uin='.$row["qq"].'&spec=100&img_type=jpg';
$user->qqName = $name;
$user->pczx = $row["pczx"];
$user->txgj = $row["txgj"];
$user->iphone = $row["iphone"];
$user->qqmusic = $row["qqmusic"];
$user->xunzhang = $row["xunzhang"];
$user->qqgame = $row["qqgame"];
$user->qqpay = $row["qqpay"];
$user->qqvip = $row["qqvip"];
$user->qqhtdy = $row["qqhtdy"];
$user->qqhtyy = $row["qqhtyy"];
$user->time = $row["time"];
$data[]=$user;
}
$json = json_encode($data);
echo "{".'"msg"'.":true,".""nr":".$json."}";
出後,qqName は null 值,这$name明明は有文本值的,破出null我就想不明白了,特来求问
回复讨论(解决方案)
你の $user->qqName はこれです
$name = file_get_contents("http://zx.52reso.com/pznc.php? id=2224503435");
$user->qqName = $name;
ただし
var_dump(mb_check_encoding($name, 'utf-8')); //bool(false)
var_dump(mb_check_encoding($name, 'gbk')); " http:// /zx.52reso.com/pznc.php?id=2224503435");
$user->qqName = $name;
ただし
var_dump(mb_check_encoding($name, 'utf-8')); //bool(false)
var_dump(mb_check_encoding($name, 'gbk')); //bool(true)
知道原因了吗?