我需要所有公司名称的值,我怎样才能得到它......
这是json的输出......
Array
(
[version] => 2
[query] => web developer
[location] => Hyderabad, Andhra Pradesh
[paginationPayload] =>
[results] => Array
(
[0] => Array
(
[company] => IBM
[country] => IN
[date] => Mon, 02 Apr 2017 07:10:15 GMT
[formattedRelativeTime] => 4 days ago
[stations] =>
)
[1] => Array
(
[company] => IPRISM
[country] => IN
[date] => Mon, 01 Apr 2017 07:10:15 GMT
[formattedRelativeTime] => 5 days ago
[stations] =>
)
[2] => Array
(
[company] => Sunlife
[country] => IN
[date] => Mon, 03 Apr 2017
[formattedRelativeTime] => 3 days ago
[stations] =>
)
)
)
我需要在新行中列出的每个公司的价值,
IBM IPRISM 阳光活力
答案 0 :(得分:1)
你必须使用foreach循环来实现你的结果
foreach($array['results'] as $company){
echo $company['company'].'<br />';
}
使用您的实际数组变量
更改名称$array
答案 1 :(得分:1)
@Sharon Moore尝试array_column():
echo implode(" ", array_column($yourArray["results"], "company"));
答案 2 :(得分:0)
试试这个:
foreach($obj['results'] as $data) // On each iteration $data will be updated with 0, 1, 2 index values
{
echo $data['jobtitle'];
}
答案 3 :(得分:0)
我想你可以试试这个
foreach ($data['result'] as $key => $value) {
echo $value['company'];
}
答案 4 :(得分:0)
尝试这样,
$i=0;
foreach($obj['results'] as $res){
echo $res[$i]['company'];
$i++;
}
答案 5 :(得分:0)
你可以尝试如下:
foreach($arr['results'] as $company)
{
echo $company['company'];
}