gpt4 book ai didi

php - 如何在 PHP 中创建泰卢固语 (UTF) json API?

转载 作者:行者123 更新时间:2023-11-29 21:45:58 25 4
gpt4 key购买 nike

Mysql 数据库包含 Tealugu 语言 (UTF) 的数据。 php 脚本以这种格式返回 json。但是无法理解。

[{"P_Title":"\u0c26\u0c4d\u0c2b\u0c4d\u0c26\u0c4d\u0c38\u0c35\u0c4d\u0c35\u0c4d"}]

请提供一个从 mysql 数据库返回 Telugu(UTF) json 的 php 脚本。

最佳答案

首先为您的网站设置适当的元标记:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

然后你可以这样做:

// $json is your json object
$array = json_decode($json, true);
echo htmlentities($array[0]['P_Title'], NULL, 'UTF-8');

输出:

ద్ఫ్ద్సవ్వ్ 

关于php - 如何在 PHP 中创建泰卢固语 (UTF) json API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34113945/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com