我有JSON数据,我需要在一行中打印类别,但类别具有多个值。
我尝试导出标签,但我坚持在一行中打印值。
打印文本中的示例:类别 1、类别2、类别 3、类别4"categories"
我尝试风箱,但不起作用:
foreach ($jf['data']['feed'] as $item1) {
$item = $item1['article'];
foreach($item['categories'] as $categories1) {
echo $categories123;
}
JSON 文件
{
"status": "success",
"data": {
"feed": [
{
"article": {
"id": "165354",
"title": "Title1",
"image_url": "example.com/image1.png",
"native_app_url": "example.com/article1",
"article_url": "example.com/article1",
"article_type": "Article",
"created_at": "2020-01-15T16:55:01Z",
"featured_time": "2020-02-19T17:19:33Z",
"author_name": "2",
"matches": [
],
"categories": [
"Categories1",
"Categories2",
"Categories3",
"Categories4"
],
"tags": [
"Tags1",
"Tags2",
"Tags3"
],
"embed_code": "<embed>12453</embed>",
"synd_code": "<embed>121245</embed>"
}
},
{
"article": {
"id": "112354",
"title": "Title2",
"image_url": "example.com/image2.png",
"native_app_url": "example.com/article2",
"article_url": "example.com/article2",
"article_type": "Article",
"created_at": "2020-01-11T16:55:01Z",
"featured_time": "2020-01-19T17:19:33Z",
"author_name": "1",
"matches": [
],
"categories": [
"Categories1",
"Categories2",
"Categories3",
"Categories4"
],
"tags": [
"Tags1",
"Tags2",
"Tags3"
],
"embed_code": "<embed>123</embed>",
"synd_code": "<embed>12345</embed>"
}
},
{
"article": {
...
}
}
],
"next_page": 2
},
"message": ""
}
胡说叔叔