Home  >  Article  >  Backend Development  >  php获取当前页面用户输入内容的方式有哪些?

php获取当前页面用户输入内容的方式有哪些?

PHPz
PHPzOriginal
2016-06-06 20:25:025259browse

php获取当前页面用户输入内容的方式有哪些?

php获取当前页面用户输入内容的方式有:

获取用户提交过来的数据一般常用的有三种:$_GET,$_POST,$GLOBALS,这三个全局变量都是数组,数组下标是用户提交过来的字段名称,比如:

<input type="text" name="number" value="123456">

则在PHP可通过如下方式获取:

$_GET[&#39;number&#39;]
$GLOBALS[&#39;number&#39;]

如果表单是POST提交过来的可以用如下方式提取

$_POST[&#39;number&#39;]
$GLOBALS[&#39;number&#39;]

$GLOBALS全局数组不管是POST提交还是GET提交都能够获取到

更多相关知识,请访问PHP中文网

Statement:
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