富贵资源网 Design By www.hznty.com

php脚本的后面名为.php,代码放置在下面的括号里面:

<"htmlcode">
<"hallo world";
"htmlcode">
<"htmlcode">
<!DOCTYPE html>
<html>
<body>

<"Hello World!<br>";
echo "Hello World!<br>";
EcHo "Hello World!<br>";
"htmlcode">
<"red";
$Color="black";
echo "my car is " . $color . "<br>";
echo "my car is " . $Color . "<br>";
"htmlcode">
<"<p>测试函数内部的变量:</p>";
 echo "变量 x 是:$x";
 echo "<br>";
 echo "变量 y 是:$y";
} 

myTest();

echo "<p>测试函数之外的变量:</p>";
echo "变量 x 是:$x";
echo "<br>";
echo "变量 y 是:$y";
"htmlcode">
<"htmlcode">
<"htmlcode">
<"htmlcode">
<"Hello world!","world");
"htmlcode">
<"GREETING", "Welcome to W3School.com.cn!");
echo GREETING;
"htmlcode">
<"H");

if ($t<"10") {
 echo "Have a good morning!";
} elseif ($t<"20") {
 echo "Have a good day!";
} else {
 echo "Have a good night!";
}
"htmlcode">
<"Number 1";
 break;
case 2:
 echo "Number 2";
 break;
case 3:
 echo "Number 3";
 break;
default:
 echo "No number between 1 and 3";
}
"htmlcode">
<"red","green","blue","yellow"); 

foreach ($colors as $value) {
 echo "$value <br>";
}
"function" 开头:

function functionName() {
  被执行的代码;
}
举个例子:

<"Hello world!";
}

writeMsg(); // 调用函数
"$fname Zhang. Born in $year <br>";
}

familyName("Li","1975");
familyName("Hong","1978");
familyName("Tao","1983");
"The height is : $minheight <br>";
}

setHeight(350);
setHeight(); // 将使用默认值 50
setHeight(135);
setHeight(80);
"5 + 10 = " . sum(5,10) . "<br>";
echo "7 + 13 = " . sum(7,13) . "<br>";
echo "2 + 4 = " . sum(2,4);
"htmlcode">
$cars=array("Volvo","BMW","SAAB");
<"Volvo","BMW","SAAB");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
"Volvo","BMW","SAAB");
echo count($cars);
"Volvo","BMW","SAAB");
$arrlength=count($cars);

for($x=0;$x<$arrlength;$x++) {
 echo $cars[$x];
 echo "<br>";
}
"htmlcode">
$age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43");

$age['Peter']="35";
$age['Ben']="37";
$age['Joe']="43";

<"Bill"=>"35","Steve"=>"37","Peter"=>"43");
echo "Peter is " . $age['Peter'] . " years old.";
"Bill"=>"35","Steve"=>"37","Peter"=>"43");

foreach($age as $x=>$x_value) {
 echo "Key=" . $x . ", Value=" . $x_value;
 echo "<br>";
}
"htmlcode">
<"Bill"=>"35","Steve"=>"37","Peter"=>"43");
asort($age);
"Bill"=>"35","Steve"=>"37","Peter"=>"43");
ksort($age);
"post" 的 HTML 表单后的表单数据。也常用于传递变量。
  
  • $_GET:$_GET 也可用于收集提交 HTML 表单 (method="get") 之后的表单数据。
  • $_FILES
  • $_ENV
  • $_COOKIE
  • $_SESSION
  • 其他内容可以在表单处理中找到。

    富贵资源网 Design By www.hznty.com
    广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
    免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
    富贵资源网 Design By www.hznty.com