【发布时间】:2016-02-19 16:50:16
【问题描述】:
尽管有recent implementation of JSON datatype to MySQL,但我在相关的 PHP 文档中找不到任何关于它的词。 我的问题是:PHP 会自动将 JSON 列的单元格转换为实际值 - 数组或文字 - 还是只提供 json 编码的字符串。喜欢:
$sql_query = "SELECT JSON_ARRAY(1,2,3)";
$result = mysqli_query($sql_query);
$value = mysqli_fetch_row($result)[0];
// what is a $value? Array(1,2,3) or a string "[1,2,3]"
// do I have to use json_decode() to get an actual array here?
(目前手头没有 MySQL 5.7,所以无法自己检查。)
【问题讨论】: