慕尼黑8549860
我为此使用 Bootstrap。以下代码不会在代码片段上运行,但您可以复制并粘贴到 php 正在运行的位置<!doctype html><html><head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script></head><body> <?php //SHOULD BE A MATRIX, SAME NUMBER OF COLUMNS $cars = array ( array("Volvo",22,18), array("BMW",15,13), array("Saab",5,2), array("Land Rover",17,15), array("Ferrari",17,15) ); $tanks = array ( array("Hellcat",220,180), array("Tiger",150,130), array("ISU",500,200), array("Cromwell",170,150) ); $fruits = array ( array("Apple",22,18), array("Banana",15,13), array("Watermelon",5,2), ); $colors = array ( array("Black",2,8), array("White",1,3), array("Blue",5,0), array("Green",7,1), array("Yellow",5,0) ); try { //If questions about css verify how Bootstrap 3 works print '<div class="container">'; print '<div class="row">'; //FOR CARS print '<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">'; for($x=0;$x<count($cars);$x++){ for($y=0;$y<count($cars[$x]);$y++){ print "<p>".$cars[$x][$y]."</p>"; } } print '</div>'; //FOR TANKS print '<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">'; for($x=0;$x<count($tanks);$x++){ for($y=0;$y<count($tanks[$x]);$y++){ print "<p>".$tanks[$x][$y]."</p>"; } } print '</div>'; print '</div>'; print '</div>'; //If questions about css verify how Bootstrap 3 works print '<div class="container">'; print '<div class="row">'; //FOR FRUITS print '<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">'; for($x=0;$x<count($fruits);$x++){ for($y=0;$y<count($fruits[$x]);$y++){ print "<p>".$fruits[$x][$y]."</p>"; } } print '</div>'; //FOR COLORS print '<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">'; for($x=0;$x<count($colors);$x++){ for($y=0;$y<count($colors[$x]);$y++){ print "<p>".$colors[$x][$y]."</p>"; } } print '</div>'; print '</div>'; print '</div>'; } catch(Exception $e) { echo 'Message: ' .$e->getMessage(); } ?></body></html>