Heim > Backend-Entwicklung > PHP-Tutorial > ,这种多维数组怎么输出呢

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-13 12:21:19
Original
1060 Leute haben es durchsucht

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

<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 />
Nach dem Login kopieren

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

------解决思路----------------------
<br />var_dump(array_column($data,'url'));<br />
Nach dem Login kopieren

去看下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);
Nach dem Login kopieren
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 />
Nach dem Login kopieren

Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage