Correcting teacher:查无此人
Correction status:qualified
Teacher's comments:完成的不错,继续努力。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>get</title>
</head>
<body>
<form action="" method="get">
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" value="">
<label for="password">密码:</label>
<input type="password" id="password" name="password" value="">
<br/>
<!--将用户输入的内容动态添加到value字段中, 创建具有粘性的表单-->
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" value="<?php echo isset($_GET['email']) ? $_GET['email'] : ''; ?>">
<label for="password">密码:</label>
<input type="password" id="password" name="password" value="<?php echo isset($_GET['password']) ? $_GET['password'] : '';?>">
<br/>
<!--简易写法-->
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" value="<?php echo $_GET['email'] ?? ''; ?>">
<label for="password">密码:</label>
<input type="password" id="password" name="password" value="<?php echo $_GET['password'] ?? ''; ?>">
<button>登录</button>
</form>
</body>
</html>
<?php
// 获取通过url发送的变量参数, php通过超全局变量$_GET获取
// $_GET是一个数组,键名就是get参数名
// 键名=>变量名, 值=>变量值
// print_r()格式化打印输出一个数组
print_r($_GET);
echo $_GET['email'];
// 获取变量之前要进行判断,用isset()
if (isset($_GET['email'])) {
echo $_GET['email'];
} else {
// 给个默认值
$_GET['email'] = '';
}
// 与js类似,可以用三元运算符进行简化
echo isset($_GET['email']) ? $_GET['email'] : '';
// 使用<pre>标签,在网页中可以实现格式化输出
echo '<pre>';
print_r($_GET);
?>
$var = 100;
var_dump( $var>=100 ? '买' : '不买' );
$var = 10000;
if($var >= 10000){
$var1 = '我要买台mac';
echo $var1;
}
$var = 10000;
if($var >= 20000){
$var1 = '我要买台mac';
echo $var1;
}else{
$var2 = '我要洗洗睡觉';
echo $var2;
}
$var = 3000;
if($var >= 10000){
echo '我要买个iphone xs max';
}else if($var >= 8000){
echo '我要买个iphone xs';
}else if($var >= 6000){
echo '我要买个iphone xr';
}else if($var >= 4000){
echo '我只能买个小米手机';
}else{
echo '我洗洗睡了';
}
$var = 10000;
switch ($var) {
case $var >= 10000:
echo '我要买个iphone xs max';
break;
case $var >= 8000:
echo '我要买个iphone xs';
break;
case $var >= 6000:
echo '我要买个iphone xr';
break;
case $var >= 4000:
echo '我只能买个小米手机';
break;
default:
echo '我洗洗睡了';
break;
}
for( $int=1; $int<10; $int++){
echo $int;
echo '<hr>';
}