您好我想在php中从mysql获取查询但不回显输出
当我在LIKE
中使用英文单词时没问题,当我在phpmy中使用带有utf8字符的查询时,管理输出就可以了
请帮帮我
<?php
header('Content-Type: application/json');
$con=mysqli_connect("localhost","root","","ebrahim");
mysqli_set_charset($con,"utf8");
$sql="SELECT * FROM content WHERE writer LIKE 'شفق'";
$result=mysqli_query($con,$sql);
$response= array();
while($row=mysqli_fetch_array($result,MYSQLI_NUM))
{
$product = array();
$product["id"] = $row[0];
$product["title"]=$row[1];
$product["image"]="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
$product["nim_body"]=$row[2];
$product["writer"]=$row[4];
array_push($response,$product);
}
echo json_encode($response,JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
?>