【发布时间】:2019-08-21 21:28:37
【问题描述】:
我正在尝试在数组中搜索元素(在本例中为“电子”),然后返回嵌套值。
我正在使用的数组
array:2 [▼
0 => array:2 [▼
"value" => "0241-6230"
"type" => "print"
]
1 => array:2 [▼
"value" => "2339-1623"
"type" => "electronic"
]
]
下面是我正在使用的代码。
<?php
$this->doi = 'anydoinumber';
$this->client = new Client();
$this->Url = 'https://api.crossref.org/works/:'.$this->doi;
$res = $this->client->get($this->Url);
$decoded_items = json_decode($res->getBody(), true);
if (isset($decoded_items['message']['issn-type'])) {
$this->issn = '';
} else {
// no electronic ISSN given
Log.Alert('No electronic ISSN for :'.$this->Doi);
}
我期待的输出
$this->issn = "2339-1623"
【问题讨论】:
-
请您显示您拥有的代码和您期望的输出示例吗?
-
请您将其添加到您的问题中,而不是将其放入 cmets :)