我有这行查询
$sql = " SELECT c.name, IF(a.addressid IS NOT NULL,0,1) AS checked
FROM customers c
LEFT JOIN addresses a
ON c.customerid = a.customerid
WHERE customerid = 123 ";
$array = array();
$GetResult = $Obj->FetchData($sql, $Obj->DEFAULT_PDO_CONNECTIONS);
while ($row = $GetResult->fetch()) {
$array[] = $row;
}
header("Content-type: application/json");
$result = json_encode($array);
echo $result;
当我以 JSON 格式回显时,它将我的checked输出显示为字符串。我想知道默认情况下 alias 的数据类型是checked什么?以及如何更改为整数数据类型?
UYOU
Cats萌萌
蝴蝶刀刀