简体   繁体   English

php如何将字符串转换为变量

[英]How to convert string into a variable in php

In PHP I am creating a table where I have inserted an input box and it is named as A,B,C,D,E,.....,Z (Caps) .在 PHP 中,我正在创建一个表,我在其中插入了一个输入框,并将其命名为A,B,C,D,E,.....,Z (Caps)

Now I have to fetch the data inserted in that particular input box.现在我必须获取插入该特定输入框中的数据。 Is there any way I can convert string A,B,C,D,E.... into a variable?有什么办法可以将字符串 A、B、C、D、E.... 转换为变量?

Keep in mind the data inserted into the input box should be fetched.请记住,应该获取插入到输入框中的数据。

Whatever is the question, you can surely use $_REQUEST["whatever"] .不管是什么问题,你肯定可以使用$_REQUEST["whatever"]

This is perfect for you at this stage, as data are always available with it, no matter the scope在这个阶段这对你来说是完美的,因为无论范围如何,数据总是可用的

In most cases, it is also very bad for security, as it allow special crafted xss , session cookie hijacking , sql injection , and more fun stuffs.在大多数情况下,它对安全性也非常不利,因为它允许特制的xss会话 cookie 劫持sql 注入和更多有趣的东西。

From my view , it is very good to play with it now , and see what are the differences with $_GET , or $_POST .我看来现在使用它非常好,看看与$_GET$_POST有什么区别。

$_REQUEST This is a 'superglobal', or automatic global, variable. $_REQUEST 这是一个“超全局”或自动全局变量。 This simply means that it is available in all scopes throughout a script.这只是意味着它在整个脚本的所有范围内都可用。 There is no need to do global $variable;不需要做全局$variable; to access it within functions or methods.在函数或方法中访问它。

The variables in $_REQUEST are provided to the script via the GET, POST, and COOKIE input mechanisms and therefore could be modified by the remote user and cannot be trusted . $_REQUEST 中的变量通过 GET、POST 和 COOKIE 输入机制提供给脚本,因此可以由远程用户修改并且不可信

http://php.net/manual/en/reserved.variables.request.php http://php.net/manual/en/reserved.variables.request.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM