我从数据库中检索mysqli-resultset,来自utf-8编码表,然后插入到数组中:
$json = array();
$query = "select artikel_titel from tblArtikel";
if($result = mysqli_query($link, $query))
{
while($line = mysqli_fetch_array($result, MYSQLI_NUM)) {
array_push($json, $line);
}
echo json_encode($json);
Run Code Online (Sandbox Code Playgroud)
数组是正确构建的,你可以在这里看到它在 页面的底部你可以看到json_encode创建的错误.我怎样才能解决这个问题?
Warning: json_encode(): Invalid UTF-8 sequence in argument in /customers/6/0/6/onezeromany.com/httpd.www/php/getArticles.php on line 13 Warning: json_encode(): Invalid UTF-8 sequence in argument in /customers/6/0/6/onezeromany.com/httpd.www/php/getArticles.php on line 13 Warning: json_encode(): Invalid UTF-8 sequence in argument in /customers/6/0/6/onezeromany.com/httpd.www/php/getArticles.php on line 13
Run Code Online (Sandbox Code Playgroud)