html 中的 METHOD 属性和 PHP 中的 POST 变量可以是不同的大小写吗?

Can the METHOD attribute in html and the POST variable in PHP be of different case?

我知道 HTML 形式的方法属性不区分大小写,并且可以包含 'post' 或 'POST'。不区分大小写。

但我的查询是,如果 HTML 中的属性是

method="post"

那我们可以用

$variable=$_POST['variable'] 

在 PHP 中捕获 post?大小写区别好吗?

我的意思是,我可以在我的 PHP 文件中使用 $variable = $_post['variable'] 或 $variable = $_POST['variable'] 吗? HTML ?

中的 method='post' 或 method='POST'

在你的html中,你可以使用method="post"method="POST"没关系,但我建议你使用post

有关,$_POST变量:

An associative array of variables passed to the current script via the HTTP POST method when using application/x-www-form-urlencoded or multipart/form-data as the HTTP Content-Type in the request.

因为是变量名所以区分大小写

那你就不能用$_post了。你必须使用 $_POST.

PHP 变量 $_POST 不变 取决于 HTML 形式 method 属性中使用的大小写。 $_POST 是 PHP 中定义的变量,它将填充来自 HTTP 请求正文的数据。这就是变量的定义方式和工作方式。 PHP 并不是将表单的 method 属性隐式转换为变量。事实上,PHP 不知道表单的 method 属性是什么,因为该信息不会传送到服务器。