Home > Backend Development > PHP Tutorial > php中request、post怎么用

php中request、post怎么用

PHPz
Release: 2020-09-04 17:28:30
Original
2561 people have browsed it

php中request和post的使用方法:首先打开php的编辑器,写上程序的注释内容;然后新建一个函数,并新建一个表单;接着使用“$_REQUEST['tireqty'];”和“$_POST['oilqty'];”方法输出结果即可。

php中request、post怎么用

php中request、post怎么用?

打开php的编辑器,写上这个程序的注释内容。

f1973f15d7abee1caf03a554b1eac1b.png

新建一个函数,命名为qingqiu

f4b163be13674912562b265e1aaf62e.png

然后新建一个表单。

<form action="jieshou.php" method="post">
tireqty:<input type="number" min=1 max=10 name="tireqty" /><br/>
oilqty:<input type="number" min=1 max=10 name="oilqty" /><br/>
sparkqty:<input type="number" min=1 max=10 name="sparkqty" /><br/>
address:<input type="text" name="address" /><br/>
<input type="submit" name="submit" /><br/>
</form>
Copy after login

bd95cefd422c578694545f1fb0594f6.png

request的使用。

$qingqiu1=$_REQUEST[&#39;tireqty&#39;];
Copy after login

5660dbcfabdd3e299e0aca3233d64b4.png

post的使用。

$qingqiu2=$_POST[&#39;oilqty&#39;];
Copy after login

e8670229810c085cd9be97ab6123531.png

GET的使用。

$qingqiu3=$_GET[&#39;sparkqty&#39;];
Copy after login

1ec43d8385fd14c31f769ea4025aa19.png

最后将这些结果输出来。

echo $qingqiu1."  ".$qingqiu2."  ".$qingqiu3;
Copy after login

9304c155e5c50d45553e59394a78cb6.png

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template