Selepas mengikuti, anda boleh menjejaki maklumat dinamiknya tepat pada masanya
Kursus dalam bahagian yang berkaitan:Fungsi PHP fungsi tersuai sintaks asas
<?php function showtable($onecolor,$twocolor='yellow',$i=0,$j=0){ $str = ""; $str .= "<table aline='center' width='800' border='1'>"; for ($i;$i<10;$i++){ if ($i%2 == 0){ $str .= "<tr bgcolor=$onecolor>"; } else { $str .= "<tr bgcolor=$twocolor>"; } for ($j;$j<10;$j++){ $str .= "<td>"; $str .= "好 "; $str .= "</td>"; } $j = 0; $str .= "</tr>"; } $str .= "</table>"; echo $str; } echo showtable('blue'); ?>
2017-12-220个赞
Kursus dalam bahagian yang berkaitan:Kawalan aliran PHP jika penyataan
<form mothod=get> <input type = "test" name ="num1"> <input type = "submit" name ="提交"> </form> <?php @header("content-Type: text/html; charset=utf-8"); @$num = $_GET["num1"]; if(is_null($num)){ print "请输入平年或闰年。"; exit; } if(preg_match('~[^0-9]+~i', $num)){ print "请输入正确的年份,如:2016。"; exit; } if(intval($num)%400 === 0 || (intval($num)%4 === 0 && intval($num)%100 != 0)) print "年份:" . intval($num) . "是闰年。"; else print "年份:" . intval($num) . "不是闰年。"; ?>
2017-12-210个赞