我在尝试执行以下功能时遇到了麻烦:
function retrieve_as_JSON($sql_statement)
{
$r = oquery($sqli); // oquery runs all that conn()->query() stuff
if($r->num_rows)
{
$arr = array();
while($tmp = $r->fetch_array( MYSQLI_ASSOC ))
{
$arr[] = json_encode($tmp);
}
return json_encode($arr);
}
}
循环中的 $tmp
是:
Array ( [code] => ecb36c8e9e70b1622fb85ce1af7ba824
[prsn] => a6abd41ca4376f1ccb5d8425e9e97ca6
[type] => Isento
[motn] => Nome da Mãe
[natu] => Joseense
[nati] => Brasileiro
[mrts] => Solteiro(a)
[conj] => Nome da esposa
[prof] => Analista/Programador
[skcl] => Caucasiano/Branca
[lafr] => 0 )
结果是" [false]"。如果没有json_encode()
,它将返回一个充满信息的常规数组()。只使用一次json编码功能,在返回或内部时,它仍然没有给出任何东西......
任何帮助?