求助,这种多维数组如何输出呢?
<br />Array<br />(<br /> [0] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6638<br /> )<br /><br /> [1] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6637<br /> )<br /><br /> [2] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6636<br /> )<br /><br /> [3] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6635<br /> )<br /><br /> [4] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6634<br /> )<br /><br /> [5] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6633<br /> )<br /><br /> [6] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6632<br /> )<br /><br /> [7] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6631<br /> )<br /><br /> [8] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6630<br /> )<br /><br /> [9] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6629<br /> )<br /><br /> [10] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6628<br /> )<br /><br /> [11] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6627<br /> )<br /><br /> [12] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6626<br /> )<br /><br /> [13] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6625<br /> )<br /><br /> [14] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6624<br /> )<br /><br /> [15] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6623<br /> )<br /><br /> [16] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6622<br /> )<br /><br /> [17] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6621<br /> )<br /><br /> [18] => Array<br /> (<br /> [url] => http://127.0.0.1/show.php?id=6620<br /> )<br /><br />)<br />
<br /><br />http://127.0.0.1/show.php?id=6638<br />http://127.0.0.1/show.php?id=6637<br />http://127.0.0.1/show.php?id=6636<br />http://127.0.0.1/show.php?id=6635<br />http://127.0.0.1/show.php?id=6634<br />http://127.0.0.1/show.php?id=6633<br />http://127.0.0.1/show.php?id=6632<br />http://127.0.0.1/show.php?id=6631<br />http://127.0.0.1/show.php?id=6630<br />http://127.0.0.1/show.php?id=6629<br />http://127.0.0.1/show.php?id=6628<br />http://127.0.0.1/show.php?id=6627<br />http://127.0.0.1/show.php?id=6626<br />http://127.0.0.1/show.php?id=6625<br />http://127.0.0.1/show.php?id=6624<br />http://127.0.0.1/show.php?id=6623<br />http://127.0.0.1/show.php?id=6622<br />http://127.0.0.1/show.php?id=6621<br />http://127.0.0.1/show.php?id=6620<br />
<br />var_dump(array_column($data,'url'));<br />
if(! function_exists('array_column')) :<br /> function array_column($input, $column_key, $index_key=null) {<br /> $res = array_map(function($tmp) use ($column_key) { return $tmp[$column_key]; }, $input);<br /> if(! empty($index_key)) $res = array_combine(array_column($input, $index_key), $res);<br /> return $res;<br /> } <br />endif;<br /><br />$records = array(<br /> array(<br /> 'id' => 2135,<br /> 'first_name' => 'John',<br /> 'last_name' => 'Doe',<br /> ),<br /> array(<br /> 'id' => 3245,<br /> 'first_name' => 'Sally',<br /> 'last_name' => 'Smith',<br /> ),<br /> array(<br /> 'id' => 5342,<br /> 'first_name' => 'Jane',<br /> 'last_name' => 'Jones',<br /> ),<br /> array(<br /> 'id' => 5623,<br /> 'first_name' => 'Peter',<br /> 'last_name' => 'Doe',<br /> )<br />);<br /> <br />$first_names = array_column($records, 'id');//'first_name');<br />print_r($first_names);<br />$last_names = array_column($records, 'last_name', 'id');<br />print_r($last_names);
Array<br />(<br /> [0] => 2135<br /> [1] => 3245<br /> [2] => 5342<br /> [3] => 5623<br />)<br />Array<br />(<br /> [2135] => Doe<br /> [3245] => Smith<br /> [5342] => Jones<br /> [5623] => Doe<br />)<br /><br />