$info = array(
"pandu nagar" => array("ravi","ramesh","sunil"),
"sharda nagar" => array("neeta","meeta","ritu")
);
我想打印输出 -
区域pandu nagar和位于ravi的人
区域pandu nagar和人员位于ramesh
区域pandu nagar和位于sunil的人
区域sharda nagar和位于neeta的人
区域sharda nagar和位于meeta的人
区域sharda nagar和位于ritu的人
答案 0 :(得分:11)
这个怎么样:
foreach ($info as $name => $locations) {
foreach ($locations as $location) {
echo "Area {$name} and person located {$location}<br />";
}
}
这意味着:
答案 1 :(得分:2)
用于打印具有一个索引名称的数组:
$info = array (
"00500" => array( "0101" => "603", "0102" => "3103", "0103" => "2022"),
"01300" => array( "0102" => "589", "0103" => "55"),
"02900" => array( "0101" => "700", "0102" => "3692", "0103" => "2077")
);
你可以这样做:
foreach ($info as $key => $values) {
foreach ($values as $anotherkey => $val) {
echo 'key:'.$key. ' AnotherKey: '.$anotherkey.' value:'.$val.'<br>';
}
}
输出将是:
key:00500 AnotherKey: 0101 value:603
key:00500 AnotherKey: 0102 value:3103
key:00500 AnotherKey: 0103 value:2022
key:01300 AnotherKey: 0102 value:589
key:01300 AnotherKey: 0103 value:55
key:02900 AnotherKey: 0101 value:700
key:02900 AnotherKey: 0102 value:3692
key:02900 AnotherKey: 0103 value:2077
答案 2 :(得分:0)
public void testFile() throws Exception {
ReadExcelFile file = new ReadExcelFile ();
//Read keyword sheet
Sheet TestSheet = file.readExcel(System.getProperty("user.dir")+"\\src\\","TestCase.xlsx" ,
"Sheet1");
}
解决此问题的最佳方法