你的代码是:
$set = array( 0 => array ( 'fname' => '',
'sname' => '',
'address' => '',
'address2' => '',
'city' => '',
'state' => 'Select State',
'zip' => '',
'county' => 'United States',
'phone' => '',
'fax' => '',
'email' => '',
'use_email' => 'on')
);
$subArray = $set[0]; // <-- key line
foreach($subArray as $k => $v) {
printf("key: %s, value: %s\n", $k, $v);
}
输出:
key: fname, value:
key: sname, value:
key: address, value:
key: address2, value:
key: city, value:
key: state, value: Select State
key: zip, value:
key: county, value: United States
key: phone, value:
key: fax, value:
key: email, value:
key: use_email, value: on
您需要正确访问索引数组。