Notice: Undefined index 如何处理
来源:互联网 发布:手机淘宝地址在哪 编辑:程序博客网 时间:2024/05/08 02:45
首先,这个不是错误,是warning。所以如果服务器不能改,每个变量使用前应当先定义。
方法1:服务器配置修改
修改php.ini配置文件,error_reporting = E_ALL & ~E_NOTICE
方法2:对变量进行初始化,规范书写(比较烦琐,因为有大量的变量)。但还没有找到好定义方法,望大家指教
方法3:每个文件头部加上:error_reporting(0); 如果不行,只有打开php.ini,找到display_errors,设置为display_errors = Off。以后任何错误 都不会提示。
方法4:做判断:isset($_GET["page"])
if-else判断;
或者加上''@''表示这行如果有错误或是警告不要輸出
如:@$page=$_GET["page"]
方法5:file1.php文件把$xx变量付一个值,用post传递给file2.php,如果file2.php没有$xx的定义,而直接使用$yy=$xx; 系统就会报错:"undifined variaable $xx", 如果file2.php的文件开始用$xx=""定义,那么file1.php的$xx值就传不过来了!
file2.php里可以这样
if(!isset($xx)) $xx=""
转自于http://blog.csdn.net/meihaoderizi123/article/details/7767520
0 0
- Notice: Undefined index 如何处理
- PHP Notice: Undefined index:
- Notice: Undefined index:
- PHP_BUG: Notice: Undefined index
- Notice: Undefined index: act
- Notice: Undefined index: 提示解决方法
- php 解决Notice: Undefined index:
- PHP Notice: undefined index 解决方法
- PHP Notice: Undefined index: ... 问题的解决方案
- Notice: Undefined index: ... 问题的解决方案
- Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方法
- Notice: Undefined index: submit……
- PHP Notice: Undefined index: ... 问题的解决方案
- PHP Notice: undefined index 完美解决方法
- php 中 Notice:undefined index 解决方法
- 【编译原理】自顶向下的语法分析之递归下降分析法
- PHP5的LDAP扩展
- 编程错误实例的剖析[1]内存不足与GC的错误用法
- /和\的区别
- 订残的9么做塞前,杂
- Notice: Undefined index 如何处理
- 豆瓣影评 盲山
- 关于java中ReentrantLock类的源码分析以及总结与例子
- Free software是什么?
- 界面原型设计工具 Axure RP开发环境搭建
- hdu 1042 N!
- c# 智能设备应用程序不显示在任务栏以及最小化窗体
- vc中的build,run,compile的区别
- win7 64位安装32位oracle ODBC数据源管理器添加数据源找不到驱动问题。