Rumah >pembangunan bahagian belakang >tutorial php > echo数组有关问题
echo数组问题
while($row=mysql_fetch_array($result))
{
list($x1,$y1) = explode('|',$row['xyz1']);
list($x2,$y2) = explode('|',$row['xyz2']);
……
$left=array($x1,$x2,……);
$top=array($y1,$y2,……);
}
$notes.= '
$ar = array ( array( 'xy1' => '1,2', 'xy2' => '3,4', 'xy3' => '5,6', 'xy4' => '7,8', ), array( 'xy1' => '11,12', 'xy2' => '13,14', 'xy3' => '15,16', 'xy4' => '17,18', ), ); foreach($ar as $r) foreach($r as $v) list($x[], $y[]) = explode(',', $v); print_r($x); print_r($y); <br><font color="#e78608">------解决方案--------------------</font><br> echo "<div class='\"note"' style='\"left:{$left[$i]}px;top:{$top[$i]}px\"'></div>"; <br><br>或者:<br>echo "<br><div class="note" style='left:".$left[$i]."px;top:".$top[$i]."px'></div><br>"; <div class="clear"> </div>