Après avoir suivi, vous pouvez suivre ses informations dynamiques en temps opportun
Cours dans la section correspondante:Fonction personnalisée de la syntaxe de base de la fonction PHP
<?php function demo($a,$b,$c,$d="yellow") { $str ="<table border =2 width =500>"; for($i=0;$i<$a;$i++) { if($i%2==0) { $str .= "<tr bgcolor =$c>"; } else { $str .="<tr bgcolor =$d>"; } for($j=0;$j<$b;$j++) { $str .="<td>".$i."x".$j."=".$i*$j."</td>"; } $str .="</tr>"; } $str .="</table>"; return $str; } $str=demo(10,10,"blue"); echo $str; ?>
2017-07-170個(gè)贊
Cours dans la section correspondante:Fonction interne de la fonction personnalisée php
<?php function foo() { echo '我是函數(shù)foo喲,調(diào)一下我才會(huì)執(zhí)行定義函數(shù)bar的過程<br />'; function bar() { echo '在foo函數(shù)內(nèi)部有個(gè)函數(shù)叫bar的函數(shù)<br />'; } } foo(); bar(); bar();bar();bar();bar();bar();bar();bar(); ?> 為什么foo();只能調(diào)用一次呢,后面都會(huì)報(bào)錯(cuò),什么原因??
2017-07-180個(gè)贊
Cours dans la section correspondante:Contr?le de flux PHP si instruction
<html> <head></head> <body> <form> <input type = 'text' name = "year"> <input type = 'submit' value = '是否是閏年?'> </form> <?php $year = $_GET['year']; if(!is_numeric($year)||!is_int($year)) { echo "please put Num OR intNum"; return; } if($year%4==0 || !($year%100)) { echo "Is run year"; } else echo "Is't run year"; ?> </body> </html>
2017-06-250個(gè)贊
<html> <head> <title>判斷成績(jī)-test</title> </head> <body> <form> <input type = 'text' name = 'cj'> <input type = 'submit' value ='是否合格?'> </form> <?php $cj = $_GET['cj']; if(!is_numeric($cj)||$cj>100) { echo "請(qǐng)正確輸入100分制成績(jī)!"; return; } if($cj<60) { echo "還不及格,必須努力了騷年~~!"; }elseif($cj>60 && $cj<=70) { echo "剛剛及格,還需要努力"; }elseif(70<$cj && $cj<90) { echo "再努力你就是王者"; }elseif ($cj>90) { echo "你現(xiàn)在是王者,但還得努力"; } ?> </body> </html>
2017-06-250個(gè)贊
Cours dans la section correspondante:Contr?le de flux PHP pour l'instruction de contr?le de boucle
<?php for($i=1; $i<10; $i++) { for($j=1;$j<=$i;$j++) { echo $i.'x'.$j.'='.$i*$j.' '; if ($i==$j) { echo '<br>'; } } } ?>
2017-07-170個(gè)贊