Blogger Information
Blog 35
fans 3
comment 0
visits 25179
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第十六课 post请求 及函数学习
随风
Original
1011 people have browsed it

post请求

`
<!--//2、POST 请求-->
<!doctype html>

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>POST 请求</title>
</head>
<body>
<form action="" method="post">
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" value="<?php echo isset($_POST['email'] ) ? $_POST['email'] : ''; ?>">
<label for="password">密码:</label>
<input type="password" id="password" name="password" value="<?php echo $_POST['password'] ? $_POST['password'] : '';?>">

<button>登录</button>




</form>


</body>
</html>

<?php
echo $_POST[‘email’];
echo ‘<br>‘;
echo $_POST[‘password’];

echo ‘<br>‘;
// 获取变量之前要进行判断,用isset()
//if (isset($_POST[‘password’])) {
// echo $_POST[‘password’];
//} else { // 给个默认值
// echo ‘空’;
//}

if (empty($_POST[‘password’])) {
echo ‘null’;
} else { // 给个默认值

  1. echo $_POST['password'];

}
echo ‘<hr>‘;
echo ‘<pre>‘;
print_r($_POST);`

pos 手抄

函数学习

`<?php

//strtolower() 将字符串转化为小写

$str = ‘ASDFG’;
$str =strtolower($str);
echo $str;
echo ‘<hr>‘;

//strtoupper 将字符串转化为大写

$str = strtoupper($str);
echo $str;
echo ‘<hr>‘;
//strlen() 获取字符串长度

echo strlen($str);
echo ‘<hr>‘;
//str_replace() 字符串替换
$a= str_replace(‘AS’,’GXG’,$str);
echo $a;
echo ‘<hr>‘;
//9、md5()
$str = ‘123456’;
echo md5($str);
echo ‘<hr>‘;

//count() 数组中元素的数量
$arr = array(
‘欧阳克’,
‘黄蓉’,
‘郭靖’
);
echo count($arr);
echo ‘<hr>‘;
//2、array_merge()
$arr1 = array(
‘欧阳克’,
‘黄蓉’
);
$arr2 = array(
‘郭靖’,
‘杨康’
);
$arr3 = array_merge($arr1,$arr2);
print_r($arr3);
echo ‘<hr>‘;
`

总结

学习了post请求和函数。

Correcting teacher:查无此人查无此人

Correction status:qualified

Teacher's comments:完成的不错,继续努力
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post