Home >Backend Development >PHP Tutorial >'Please do not access the superglobal $_GET array directly'

'Please do not access the superglobal $_GET array directly'

WBOY
WBOYOriginal
2016-07-29 09:13:161792browse

I downloaded an IDE called NetBeans to develop a PHP program. When I entered the commonly used $name = $_GET['name'];, I received a warning: Please do not directly access the super-global $_GET array. Please change it. Use some filtering functions (such as filter_input(), conditions with is_*() functions, etc.) . Only then did I realize that my usual approach was not standardized. In fact, the warning can be eliminated by changing it to the following form:

<code>$name = "";
if(is_string($_GET['name'])){
	$name = strval($_GET['name']);
}</code>

Since the programming language I use is relatively complicated, sometimes I don’t download a special IDE. For windows, I usually just use Hidemaru and Editplus. type editor; while Mac is more lazy and uses Xcode directly. But now I feel that NetBeans is really good, and it helped me realize this irregular writing method. It seems that in the future we should follow the saying "If a worker wants to do his job well, he must first sharpen his tools."

The above introduces "Please do not directly access the super-global $_GET array", including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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