开发者

php5 shorthand variables

I have seen most of the developers use $name instead of $_GET['name'] and $domain instead of $_POST['domain'], is this shorthand by php5 and is it safe or any docume开发者_开发百科ntation for it.


This works because they're using the (ill-advised and now thankfully deprecated) register_globals feature. (See the PHP manual section on Using Register Globals for the full low-down including security related information.)

I'd really recommend not using this approach and explicitly using the $_POST or $_GET variables instead, as there's a potential world of security issues that await you otherwise.


The examples you listed are only available if register_globals is set. It is deprecated as of PHP 5.3 and should not be used as it is a security risk among other things.

Read more from the docs - http://php.net/manual/en/security.globals.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜