如何在数组中允许特殊字符?

时间:2019-01-09 06:33:43

标签: php arrays json

我从数据库中得到一个结果,并且在其中一个结果中,当我不包含该结果时,该“á”字符就会出现在数组中并找到结果,但是当我添加该结果时回到它,它只是给我一个空白页,将如何显示它?

这就是我现在拥有的

include('../connect.php');
include('../helper.php');
header("Content-type: application/json; charset=utf-8"); 
$recentTreningVideos = GetTrendingVideos($con);
//$newlyAddedVideos = GetNewlyAddedVideos($con);

//ob_start();


$array[] = array("key1" => "value1", "key2" => "value2");   

while($row = mysqli_fetch_assoc($recentTreningVideos))
{


    $TrendImageURL = $row['youtubethumbnail'];
    $TrendSongName = $row['musicvideotitle'];
    $TrendCleanSongname = $row['songname'];

    $array[] = array(
                    "youtubethumbnail" => $row['youtubethumbnail'], 
                    "musicvideotitle" => $row['musicvideotitle'] (THIS ONE HAS THE RESULT WITH THE CHARACTER IN IT but if you put something like "sdfsdfsdf" in there it displays all the results and does not give a blank page
                    );
}

echo json_encode($array);

0 个答案:

没有答案