【php】php中Undefined index和Undefined variable错误的解决方法
2012-11-26 11:01
435 查看
$act=$_POST['act'];
用以上代码总是提示
Notice: Undefined index: act in F:\windsflybook\post.php on line 18
另外,有时还会出现
引用内容
Notice: Undefined variable: Submit ......
等一些这样的提示
原因:由于变量未定义引起的
解决方法:
1) error_reporting设置:
找到error_reporting = E_ALL
修改为error_reporting = E_ALL & ~E_NOTICE
2) register_globals设置:
找到register_globals = Off
修改为register_globals = On
Notice: Undefined variable: email in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9
Notice: Undefined variable: subject in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9
Notice: Undefined variable: comment in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9
用以上代码总是提示
Notice: Undefined index: act in F:\windsflybook\post.php on line 18
另外,有时还会出现
引用内容
Notice: Undefined variable: Submit ......
等一些这样的提示
原因:由于变量未定义引起的
解决方法:
1) error_reporting设置:
找到error_reporting = E_ALL
修改为error_reporting = E_ALL & ~E_NOTICE
2) register_globals设置:
找到register_globals = Off
修改为register_globals = On
Notice: Undefined variable: email in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9
Notice: Undefined variable: subject in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9
Notice: Undefined variable: comment in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9
........ 本来php是不需要定义变量的,但是出现这种情况应该怎么办呢? 只要在C:\WINDOWS找出php.ini的 在php.ini中的302行 error_reporting = E_ALL 修改成 error_reporting = E_ALL & ~E_NOTICE再重启apache2.2就行了 解决方法:修改php.ini 将: error_reporting = E_ALL 修改为:error_reporting = E_ALL & ~E_NOTICE 如果什么错误都不想让显示,直接修改: display_errors = Off 如果你没有php.ini的修改权限,可在php头部加入 ini_set("error_reporting","E_ALL & ~E_NOTICE"); 即可 |
相关文章推荐
- php Undefined index和Undefined variable的解决方法$_GET
- PHP Notice: Undefined index和Undefined variable问题的解决方法:
- php Undefined index和Undefined variable的解决方法
- 提示Notice: Undefined index和Undefined variable的解决方法
- PHP" Undefined index"和"Undefined variable"的解决方法
- ThinkPHP调用common/common.php函数提示错误function undefined的解决方法
- php Undefined index和Undefined variable的解决方法
- PHP 5.3.10 编译安装时出现 undefined reference to `libiconv' 错误的解决方法
- php Notice: Undefined index 错误提示解决方法
- php Notice: Undefined index 错误提示解决方法
- php当中出现的错误:Use of undefined constant title - assumed 'title'的解决方法
- 关于PHP语言中的解决Undefined variable: _SESSION的方法
- PHP:Call to undefined function curl_init 错误解决方法
- 在wx python下总是提示“undefined variable from import:xxx”错误解决方法
- php Notice: Undefined index 错误提示解决方法
- 提示Notice: Undefined index和Undefined variable的解决方法
- PHP错误Notice : Use of undefined constant 的完美解决方法
- php Undefined index和Undefined variable的解决方法
- php Undefined index和Undefined variable的解决方法
- ThinkPHP调用common/common.php函数提示错误function undefined的解决方法