我正在尝试通过在 ionWordpress(离子框架插件)中使用 JSON 来获取 wordpress 的数据。
我正在使用 JSON API。这是来自我的 JSON 的数据。
{
"status": "ok",
"count": 6,
"count_total": 45,
"pages": 8,
"posts": [
{
"id": 1874,
"type": "event",
"slug": "stesets",
"url": "http://www.web.com/page",
"status": "publish",
"title": "setst",
"title_plain": "tests",
"content": "testsetstst",
"excerpt": "testsetststtes",
"date": "2017-11-27 17:20:17",
"modified": "2017-11-27 17:20:17",
"categories": [],
"tags": [],
"author": {
"id": 1,
"slug": "test",
"name": "test",
"first_name": "",
"last_name": "",
"nickname": "test",
"url": "",
"description": ""
},
"comments": [],
"attachments": [],
"comment_count": 0,
"comment_status": "closed",
"thumbnail": "http://www.website.com/wp-content/uploads/2017/11/image.jpg",
我的问题是当我尝试获取数据时,它也包含 []。例如。
{{post.thumbnail}}
这将显示 [" http://www.website.com/wp-content/uploads/2017/11/image.jpg "]
但我只想要链接本身没有 [" "]
我该怎么做呢?
我用了:
{{post.thumbnail[0]}}
如 Diluk Angelo 的评论中所述。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句