第一个入门级的例子

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>index.php</title>
</head>

<body>
<span style="color:Red;">
<?php
echo "Hello,This is my first php program!\n";

?></span><br/><br/><br/><br/><br/>
<?php
echo "这是第一种例子。\n";	//本例是C++语法的注释
/*本例采用多行的
  注释方式*/
  echo "这是第两种例子。\n";
  echo "这是第三种例子。\n"; #本例使用UNIX Shell 语法注释

?><br/><br/><br/><br/><br/>
<span style="color:Red">   我定义一个变量define("user","tianshi0253");</span><br/>
PHP程序输出为:<span style="color:Green;">
<?php
define("USER","tianshi0253");
echo (USER);
?>

</span><br/><?PHP
echo $Name="yaowenchao";
?><br/><br/><br/>
<?php
	#静态变量的例子
	function myfunc(){
		static $mystr;
		$mystr.="哈";
		echo $mystr."<br/>\n";
	}
	myfunc();
	myfunc();
	myfunc();
?>

</body>
</html>

 

评论
发表评论

您还没有登录,请登录后发表评论