[英]what is Json Format of wp_posts in api of wordpress?
i want to get the post_content from wp_posts table in wordpress from an api ,我想从 api 中的 wordpress 中的 wp_posts 表中获取 post_content ,
i am using utf8 encoding format , when i get the output from json api , the我使用的是 utf8 编码格式,当我从 json api 获得输出时,
field that i want is like this :我想要的领域是这样的:
"post_title":"\u0631\u0627\u06cc\u06af\u0627\u0646"
and my post_title is in persian language ,i want to turn this code to its我的 post_title 是波斯语,我想把这段代码改成它的
origin to get in persian .起源于波斯语。
how can i turn this formated text into my language in android studio ?如何在 android studio 中将此格式化文本转换为我的语言?
Wordpress (as far as I know) still uses serialized data. Wordpress(据我所知)仍然使用序列化数据。 You need to unserialize:您需要反序列化:
unserialize($mydata);
Ok , Since again Nobody helped me , I found my answer Yohooooooooooooooo ....好的,因为再次没有人帮助我,我找到了我的答案 Yohoooooooooooooooo ....
the answer is simple ,答案很简单,
in API just replace this :在 API 中只需替换这个:
echo json_encode($myarray);
with this有了这个
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));
i am sure this is work for anyone .我相信这对任何人都有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.