json_encode数组上返回空值


json_encode returning null on array

我正在尝试json_encode一个php数组,但是"选择"部分返回null。

Array ( [indexer] => 7 [section] => 1 [question] => What does the last paragraph indicate about an optimistic perspective? [answer] => a [choices] => There has never been a culture or religion that is genuinely optimistic`It is “a riddle of the universe”`No enlightened culture sees the world in a truly optimistic manner`Optimistic perspectives are only held by the weak )
{"indexer":"7","section":"1","question":"What does the last paragraph indicate about an optimistic perspective?","answerswer":"a","choices":null}

有什么想法吗?

编辑:完整代码:

$check = mysqli_query($con, "select * from questions where section = '$section' and indexer = '$question'");
$result = mysqli_fetch_array($check, MYSQLI_ASSOC);
print_r($result);
echo json_encode($result);

>json_encode希望您编码的所有内容都是有效的 UTF-8。如果内容的任何部分不是正确的 UTF-8,则该部分的 UTF-8 json_encode将以静默方式失败 (b

所有字符串数据都必须采用 UTF-8 编码。

我的猜测是标记没有正确 UTF-8 编码(但源自基于 CP1252 的编码)。

请参阅json_last_error以从 json 模块检索最后一个错误代码。