Rumah > pembangunan bahagian belakang > tutorial php > ,这种多维数组怎么输出呢

,这种多维数组怎么输出呢

WBOY
Lepaskan: 2016-06-13 12:21:19
asal
1000 orang telah melayarinya

求助,这种多维数组如何输出呢?

<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 />
Salin selepas log masuk

数组打印出来是这种格式,我想最后输出是这样的格式,怎么做呢?请大神赐教
<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 />
Salin selepas log masuk

------解决思路----------------------
<br />var_dump(array_column($data,'url'));<br />
Salin selepas log masuk

去看下array_column函数就知道了
------解决思路----------------------
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);
Salin selepas log masuk
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 />
Salin selepas log masuk

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan