简体   繁体   English

使用JSON API的Wordpress过滤器自定义帖子类型

[英]Wordpress filter custom post type with json api

I want to query for custom post type with json api and get back following response for custom post type. 我想使用json api查询自定义帖子类型,并返回以下自定义帖子类型的响应。

Is it possible to parse this response and display? 是否可以解析此响应并显示?

"a:4:{i:0;a:1:{s:11:"instruction";s:149:"Patlıcanları alacalı soyup iri doğrayın. Yağlı kağıt serili fırın tepsisine alın. Üzerlerine zeytinyağı gezdirip tuz karabiber serpin.";}i:1;a:1:{s:11:"instruction";s:193:"Önceden ısıtılmış 200 derece fırında 30-35 dakika kadar közleyin. Kalan zeytinyağını ayrı bir tavada ısıtın. İnce doğradığınız yeşillikleri hafif soteleyip ocaktan alın.";}i:2;a:1:{s:11:"instruction";s:185:"Közlediğiniz patlıcanlar, yeşillikler, rendelediğiniz beyaz peynir, yoğurt ve sebze suyunu geniş bir kaseye alın. Pürüzsüz bir kıvam elde edinceye kadar blenderdan geçirin.";}i:3;a:1:{s:11:"instruction";s:109:"Buzdolabına iki saat dinlendirin. Üzerini halka fesleğen yaprakları ile süsleyerek soğuk servis yapın";}}"

Like instruction step 1 Step 2. 就像指示步骤1步骤2。

For PHP 对于PHP

json_decode() Takes a JSON encoded string and converts it into a PHP variable. json_decode()获取JSON编码的字符串,并将其转换为PHP变量。

For more info: 有关更多信息:

http://php.net/manual/en/function.json-decode.php http://php.net/manual/zh/function.json-decode.php

You can find implementation code here: 您可以在此处找到实现代码:

Parsing JSON file with PHP How do I extract data from JSON with PHP? 使用PHP解析JSON文件 如何 使用PHP 从JSON提取数据?

For JavaScript 对于JavaScript

How to access JSON encoded data of an array using javascript 如何使用JavaScript访问数组的JSON编码数据

For Angular JS 对于Angular JS

How would I access this JSON data in AngularJS? 如何在AngularJS中访问此JSON数据? How to access JSON array object in HTML using angular? 如何使用angular访问HTML中的JSON数组对象?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM