WordPress的api中wp_posts的Json格式是什么?

问题描述 投票:-1回答:2

我想从api中的wordpress中的wp_posts表中获取post_content,

我正在使用utf8编码格式,当我从json api获得输出时,

我想要的字段是这样的:

"post_title":"\u0631\u0627\u06cc\u06af\u0627\u0646"

我的post_title是波斯语,我想把这个代码转换成它

进入波斯语的起源。

如何在Android studio中将此格式化文本转换为我的语言?

android json wordpress api
2个回答
0
投票

Wordpress(据我所知)仍然使用序列化数据。你需要反序列化:

unserialize($mydata);

0
投票

好的,既然没有人帮助我,我找到了答案Yohooooooooooooooo ....

答案很简单,

在API中只需替换它:

echo json_encode($myarray);

有了这个

echo preg_replace_callback("/\\\\u([a-f0-9]{4})/iu", function($m){return iconv('UCS-4LE','UTF-8',pack('V', hexdec('U'.$m[1])));}, json_encode($myarrauy));

我相信这对任何人都有用。

© www.soinside.com 2019 - 2024. All rights reserved.