Blogger Information
Blog 16
fans 0
comment 0
visits 11415
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP运行原理与请求类型-2019年4月15日20时00分
多@点的博客
Original
860 people have browsed it

今天,我们将进入到PHP的学习,首先是对PHP的认识与了解,学习了PHP运行原理与请求类型,下面是我的练习:


1.PHP运行原理图3.jpg

2.get请求

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>get请求</title>
</head>
<body>
    <h2>用户登录</h2>
	<form action="" method="get">
        <label for="email">邮箱:</label>
        <input type="email" id="email" name="email" value="<?=$_GET['email']?:''?>">
        <br>
        <label for="password">密码:</label>
        <input type="password" id="password" name="password" value="<?=$_GET['password']?:''?>">
        <br>
        <button>登录</button>
	</form>
</body>
</html>

<?php
    echo '<pre>';
    print_r($_GET);

?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

1.jpg

get请求:
.请求参数以键值对的方式,附加到URL地址上,称为查询字符串,用‘?’号与当前脚本分隔;
.URL格式:“index.php?name=peter&age=30”;
.受URL长度限制,‘GET’方式传递的数据也有限制的;
.服务器端脚本使用预定义变量数组‘$_GET’进行接收;


3.post请求

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>post请求</title>
</head>
<body>
    <h2>用户登录</h2>
	<form action="" method="post">
        <label for="email">邮箱:</label>
        <input type="email" id="email" name="email" value="<?=$_POST['email']?:''?>">
        <br>
        <label for="password">密码:</label>
        <input type="password" id="password" name="password" value="<?=$_POST['password']?:''?>">
        <br>
        <button>登录</button>
	</form>
</body>
</html>

<?php
    echo '<pre>';
    print_r($_POST);

?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

2.jpg

post请求:
.请求参数放在‘header’请求头中发送,url地址看不到请求参数,适合敏感信息;
.通常是通过表单提交,并用来更新服务器上的信息;
.适合发送大量的数据到服务器端,长度受到配置文件限制,但比‘GET’要大得多;
.服务器端脚本使用预定义变量数组‘$_POST’进行接收;

Correction status:Uncorrected

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