$row_properties = array(
"Header 1"=>array("width"=>20,"align"=>'C',"colors"=>array(100,220,255)),
"Header 2"=>array("width"=>20,"align"=>'C',"colors"=>array(100,220,255)),
"Header 3"=>array("width"=>20,"align"=>'C',"colors"=>array(100,220,255)),
);
我尝试像这样将widths
和algins
colors
作为数组
$widths = array(20,20,20);
$aligns = array("C","C","C")
$colors array(array(100,220,255),array(100,220,255),array(100,220,255));
$widths = $aligns = $colors = array();
foreach ($row_properties as $prop) {
$widths[] = $prop['width'];
$aligns[] = $prop['align'];
$colors[] = $prop['color'];
}
$widths = array();
$aligns = array();
$colors = array();
foreach($row_properties as $property) {
$widths[] = $property['width'];
$aligns[] = $property['align'];
$colors[] = $property['colors'];
}
就是这样:)
$widths = array();
$aligns = array();
foreach($row_properties as $row){
$widths[] = $row['width'];
$aligns[] = $row['align'];
}