相思资源网 Design By www.200059.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
  • 其他内容可以在表单处理中找到。

    标签:
    PHP,语法

    相思资源网 Design By www.200059.com
    广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
    免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
    相思资源网 Design By www.200059.com

    评论“PHP编程基本语法快速入门手册”

    暂无PHP编程基本语法快速入门手册的评论...

    RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

    三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

    首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

    据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。