Questions about array values! Digest [md5] & gt; b68d88dbdfc9d0af2e0bbd85a4ccd questions about array values!
PHP code
// Known array $ info = array (); // outputs print_r ($ info ); // result Array ([0] => Array ([name] => 8.gif [md5] => token [saveName] => 20120602080557_452.gif [size] => 1 [type] => image/gif [originalHeight] => 39 [originalWidth] => 31) [1] => Array ([name] => 9.gif [md5] => 4988f85ebebf82f56d70eeaf39a67016 [saveName] => 20120602080557_776.gif [size] => 2 [type] => image/gif [originalHeight] => 39 [originalWidth] => 31 ))
How can I retrieve the corresponding saveName value?
------ Solution --------------------
PHP code
Foreach ($ info as $ value) {foreach ($ value as $ getValue) {echo $ getValue ['savename'];}
------ Solution --------------------
Foreach ($ info as $ v) $ temp [] = $ v ['savename'];
Print_r ($ temp );
------ Solution --------------------
It seems that name is similar to a unique field and you want to retrieve the savename field corresponding to name. In this case, you need to receive the name field value you have given. when you submit it in the post form.
Two-dimensional array. A foreach statement is enough.
PHP code
$ A = Array ('name' => '8.gif ', 'md5' => 'clerk', 'savename' => '20120602080557_452.gif', 'size' => 1, 'type' => 'image/gif ', 'ininalheight' => 39, 'originalwidth' => 31), Array ('name' => '9.gif ', 'md5' => '4988f85ebebf82f56d70eeaf39a67016 ', 'savename' => '20120602080557_776.gif', 'size' => 2, 'type' => 'image/GIF ', 'originalheight' => 39, 'originalwidth' => 31,); foreach ($ a as $ k => $ v) {if ($ v ['name'] ===$ _ POST ['yourname']) {// __post+'yourname'{'8.gif ', $ v else echo' $ v ['will be output ['. 'savename '. '] = '. $ v ['savename'].'
';}}?>