1.get请求
2.post请求
3.文件上传
/**************************************************************get请求*****************************************************************/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="get.php" method="get">
名字:<input name="name" type="text"><br>
名字:<input type="submit" value="get 提交"><br>
</form>
</body>
</html>
<?php
if ($_GET['name']){
echo '我的名字是'.$_GET['name'];
}else{
echo '请输入name';
}
/**************************************************************post请求*****************************************************************/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="post.php" method="post">
a:<input name="a" type="text"><br>
b:<input name="b" type="text"><br>
<input type="submit" value="post 提交"><br>
</form>
</body>
</html>
<?php
if (isset($_POST['a'])&&isset($_POST['b'])&&$_POST['a']&&$_POST['b']){
echo '结果是:'.($_POST['a']+$_POST['b']);
}else{
echo '请输入ab';
}
/**************************************************************文件上传*****************************************************************/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>文件上传</title>
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="提交上传">
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$f = $_FILES['file'];
move_uploaded_file($f['tmp_name'],$f);
echo "<img src = '$f'>";
?>
</body>
</html>