<form>
<input type="text" name="num1">
<input type="submit" value="计算">
</form>
<?php
$num1 =$_GET['num1'];
if(!is_numeric($num1)){
echo '请输入年份';
}
if($num1%4=0 && $num1%100!=0){
echo '闰年';
}
if($num1%400=0){
echo '闰年';
}
if($num1%4!=0 | $num1%400!=0){
echo '平年';
}
/*疑问:我在本地写了这个,保存为html打开之后表单在,但是点了计算之后是空白页面。请问是我保存的方式不对吗?应该如何保存文件*/
>
Since it is the year, why do we need to use the is_numeric() function? The year should be an integer greater than 0
Assignments and questions-PHP Chinese website Q&A-Assignments and questions-PHP Chinese website Q&A
Look around and learn.
保存为PHP文件。