注意:未定义的索引...... [英] Notice: Undefined index...

查看:158
本文介绍了注意:未定义的索引......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在生产网站上发现了我的错误报告

到E_ALL,以确保我在编写代码时使用''最佳实践''。


到目前为止,它已经帮助我训练自己初始化我的

变量。我遇到了我的$ _POST数组的问题。


我自我引用一个表单页面进行处理,所以在开始时我

am寻找某些$ _POST变量的存在进行处理。


我将''action''字段设置为''login''例如。


我已经多次这样做了没有问题,即使在这个

的情况下也没有致命的错误。然而,我收到一条通知,我正在查看我的

$ _POST变量是未申报的。


注意:未定义的索引:动作


我无法在

检查之前公开看到一种声明$ _POST [''action'']的方法,因为它是由服务器设置的,当页面是这是我的实际代码片段:


if($ _ POST [''action''] ===''登录''){

//处理数据//

}


我是否需要学习忽略此特定错误或有什么东西

我没看到?


谢谢

Scotty

I have since recently turned up my error reporting on a production site
to E_ALL to ensure I am using ''best practices'' when writing out code.

So far it has helped me discipline myself with initializing my
variables. I am running into a problem with my $_POST array though.

I am self-referencing a form page for processing, so at the beginning I
am looking for the existence of certain $_POST variables for processing.

I am setting an ''action'' field to ''login'' for example.

I have done this on several occasions with no problems and even in this
case there is no fatal error. I am however receiving a NOTICE that my
$_POST variables I am looking at is undeclared.

"Notice: Undefined index: action"

I cannot openly see a way to declare the $_POST[''action''] prior to
checking it since it is set by the server when the page is loaded.

Here is my actual code snippet:

if($_POST[''action''] === ''login'') {
//process data//
}

Will I need to learn to ignore this specific error or is there something
I am not seeing?

Thanks
Scotty

推荐答案

_POST数组虽然。


我自我引用一个表单页面进行处理,所以在开始时我

am寻找是否存在某些
_POST array though.

I am self-referencing a form page for processing, so at the beginning I
am looking for the existence of certain


_POST变量进行处理。


我正在设置一个''action''字段''登录''例如。


我已经多次这样做了没有问题,即使在这个

的情况下也没有致命的错误。我收到的通知是,我正在查看我的
_POST variables for processing.

I am setting an ''action'' field to ''login'' for example.

I have done this on several occasions with no problems and even in this
case there is no fatal error. I am however receiving a NOTICE that my


_POST变量未申报。


"注意:未定义的索引:行动


我无法公开看到宣布
_POST variables I am looking at is undeclared.

"Notice: Undefined index: action"

I cannot openly see a way to declare the

的方式

这篇关于注意:未定义的索引......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆