如何存取权限的JSON API ACF领域的关系权限、领域、关系、API

由网友(远镇)分享简介:我是一个字preSS风扇,并与高级自定义字段插件工作的时间最多。我有一个是与关系字段从ACF插件。我在一个移动版本目前正在那里我使用的是插件JSON API 和 AngularJS 。它完美的作品,而不是关系字段值。 i'm a Wordpress fan and working the most time with...

我是一个字preSS风扇,并与高级自定义字段插件工作的时间最多。我有一个是与关系字段从ACF插件。我在一个移动版本目前正在那里我使用的是插件JSON API 和 AngularJS 。它完美的作品,而不是关系字段值。

i'm a Wordpress fan and working the most time with the Advanced Custom Fields Plugin. I have two Custom Post Types which are linked together with the relationship field from the ACF Plugin. I'm working currently on a mobile Version where i'm using the Plugin JSON API and AngularJS. It works perfectly, instead the relation field values.

结果这是我看到的JSON文件与1链接资源:

This i see in the JSON File with 1 linked resource:

["a:1:{i:0;s:3:"163";}", "a:1:{i:0;s:3:"163";}"] 

结果

和这2链接资源:

["a:2:{i:0;s:3:"261";i:1;s:2:"56";}", "a:2:{i:0;s:3:"261";i:1;s:2:"56";}"] 

结果

这是从JSON文件的一块。相关领域的扬声器与丑陋的ID在里面。这就是我从字preSS JSON API获得。

This is a piece from the JSON File. The related fields are "Speakers" with the ugly ID's in it. Thats what I get from JSON API from Wordpress.

"custom_fields": {
            "main_statement": [
                "",
                ""
            ],
            "type_of_presentation": [
                "keynote",
                "keynote"
            ],
            "room": [
                "no_room",
                "no_room"
            ],
            "skill_level": [
                "null",
                "null"
            ],
            "start_date": [
                "1412084700",
                "1412084700"
            ],
            "end_date": [
                "1412087700",
                "1412087700"
            ],
            "speakers": [
                "a:1:{i:0;s:3:"154";}",
                "a:1:{i:0;s:3:"154";}"
            ]
        }

结果

你有什么线索,我怎么能得到ID的出这混乱的东西,这样我就可以搜索ID在整个JSON对象以显示相关的帖子?

Do you have any clue how i can get the ID's out of this messy thing, so that I can search for the ID's in the whole JSON Object to display the related posts?

非常感谢!

最好的问候

推荐答案

扬声器数据是一个PHP的连载阵。所以,你基本上只需要使用反序列化() PHP函数。我测试了它,它的确,提取阵列的ID

"Speakers" data is a php serialized array. So you basically just need to use unserialize() php function. I tested it and it, indeed, extract the IDs in arrays

的 json_de code()将不会对非JSON数据。的

阅读全文

相关推荐

最新文章