互联网程序设计·PHP语言之基本语法

互联网程序设计·PHP语言之基本语法

<html>
	<head>
	<meta http-equiv='Content-Type' content='text/html; charset=gb2312' /> 
	</head>
		<body>
		<?php
		/********** Begin *********/

		echo "Hello,world!";


		/********** End *********/	
		?>
		</body>
</html> 

第2关 PHP数据类型与变量 – 20个苹果与10个机器人

<html>
	<head>
		<meta http-equiv='Content-Type' content='text/html; charset=gb2312' /> 
	</head>
	<body bgcolor="#3498db">
	<?php
	  $n_Apple=0.5;
	/********** Begin *********/
	$n_Apple = 20;
	$n_Android = 10;
	$str1 = "Android: ";
	$str2 = "Apple: ";
	
	
  /********** End *********/	
		echo $str1.$n_Android." ".$str2.$n_Apple;
	?>
	
	</body>
</html> 

第3关 PHP的运算符

<html>
	<head>
		<meta http-equiv='Content-Type' content='text/html; charset=gb2312' /> 
	</head>
	<body>
 
		<?php
 	 		 $year=2000;
    		/******** Begin *********/
    		if($year %4 == 0 && $year %100 !=0 || $year %400 == 0){
				echo $year."年是闰年";
    		}else{ //判断不是闰年,执行else中的语句
				echo $year."年不是闰年";
			} 
				 /********** End ********/
		?>
   
	</body>
</html>
515 Views
分享你的喜爱
linwute
linwute

我要像梦一样自由,像大地一样宽容;
在艰辛放逐的路上,点亮生命的光芒;
我要像梦一样自由,像天空一样坚强;
在曲折蜿蜒的路上,体验生命的意义;

留下评论

您的电子邮箱地址不会被公开。 必填项已用*标注