我有一些JSON,如下所示
"tags":
{
"business-school":
{
"name": "Business School",
"slug": "business-school",
"parent": 0,
"description": "",
"post_count": 13,
"id": 169072,
"taxonomy": "post_tag"
},
"canterbury":
{
"name": "Canterbury",
"slug": "canterbury",
"parent": 0,
"description": "",
"post_count": 37,
"id": 5349,
"taxonomy": "post_tag"
我已设法显示随帖子输入的相关标签。在其他博客上虽然我已经看到标签作为超链接,并想知道这是如何实现的。他们会联系到什么?是否有可能在JSON框架内使用PHP记住我不熟悉JSON,或者它最好留给博客网站。
答案 0 :(得分:0)
如果您可以保持下面的数据关系,那么您也可以使用HYPERLINKS技术轻松实现与您的博客文章相同的TAG。
TAGS的格式每个标记都与ID相关联
所以你的锚链接就像 -
https://blogs.canterbury.ac.uk/cafa/tag/555/
https://blogs.canterbury.ac.uk/cafa/tag/777/
"tags":
{
"business-school":
{
"name": "Business School",
"slug": "business-school",
"parent": 0,
"description": "",
"post_count": 13,
"id": 169072,
"taxonomy": "post_tag",
"tag_id": 555
},
"canterbury":
{
"name": "Canterbury",
"slug": "canterbury",
"parent": 0,
"description": "",
"post_count": 37,
"id": 5349,
"taxonomy": "post_tag",
"tag_id": 777
}
}
关于这些TAG ID的Blog Post格式
当用户点击任何这些超链接时,您将获得TAG ID&从这些TAG ID中,您可以使用这些ID标记相应的POSTS。 Ex-TAG ID 555与2个POSTS相关联。
{
"555": [{
"blog_id": 111,
"blog_excerpt": "your blog excerpt",
"date": "2017-04-15"
}, {
"blog_id": 222,
"blog_excerpt": "your blog excerpt",
"date": "2017-04-16"
}],
"777": [{
"blog_id": 333,
"blog_excerpt": "your blog excerpt",
"date": "2017-04-17"
}, {
"blog_id": 444,
"blog_excerpt": "your blog excerpt",
"date": "2017-04-18"
}]
}
希望你能得到我的观点。