0
我有1個數據庫。在那裏我有一個tabel。 我在做這個代碼json解析。
我已經使用這個PHP代碼檢索值:特殊字符爲空值
<head>
<style type="text/css">
.auto-style1 {
text-align: right;
}
</style>
</head>
<?php
echo getdata($_REQUEST['lastupdate']);
function getdata($lastupdatedate){
$obj = json_decode($json);
$con = mysql_connect("localhost","root","Password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("roster", $con);
$query = "select * from statedeathtax_v2 where LastUpdated > '".$lastupdatedate."' order by LastUpdated";
$rs = mysql_query($query) or die($query);
//print_r($rs);
while($row=mysql_fetch_assoc($rs)){
$record[] = $row;
}
$data = json_encode($record);
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
return $data;
}
?>
下面這段代碼並不顯示特殊字符,如「$」。 當我在這段代碼中引入查詢時,它顯示具有特殊字符的列的空值。 我沒有收到問題。
[ヶ輛]檢查(HTTP:/ /php.net/manual/function。 htmlentities.php)? – StasGrin