标签:
第七节 GET与POST请求
1GET
//get if(isset($_GET[‘name‘])&&$_GET[‘name‘]) { echo ‘Hello‘.$_GET[‘name‘]; } else { echo ‘请输入名字‘; }
2POST
//post if($_POST[‘a‘] && $_POST[‘b‘]) { echo $_POST[‘a‘]+ $_POST[‘b‘]; }else { echo ‘请输入参数‘; }
3上传文件
<form action="upload2.php" method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" name="submit"> </form>
$file= $_FILES[‘file‘]; $fileName = $file[‘name‘]; move_uploaded_file( $file[‘tmp_name‘], $fileName); echo "<img src=‘$fileName‘";
标签:
原文地址:http://www.cnblogs.com/linksun/p/4469200.html