PHP Notice: Undefined index: ... 问题的解决方法:
来源:互联网 发布:foxmail mac 编辑:程序博客网 时间:2024/05/18 01:12
FROM:
http://www.mycodes.net/74/2360.htm
首先,这个不是错误,是warning。所以如果服务器不能改,每个变量使用前应当先定义。
方法1:服务器配置修改
修改php.ini配置文件,error_reporting = E_ALL & ~E_NOTICE
////以上方法测试过,方法2,3未测试过
方法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="";
0 0
- PHP Notice: Undefined index: ... 问题的解决方法
- PHP Notice: Undefined index: ... 问题的解决方法:
- PHP Notice: Undefined index: ... 问题的解决方法:
- PHP Notice: Undefined index: ... 问题的解决方法:
- PHP Notice: Undefined index: ... 问题的解决方法:
- PHP Notice: Undefined index和Undefined variable问题的解决方法:
- PHP Notice: undefined index 解决方法
- PHP Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- php出现 Notice: Undefined index: name 的解决方法
- PHP Notice: undefined index 完美解决方法
- php 中 Notice:undefined index 解决方法
- php提示Notice: Undefined index解决方法
- PHP Notice: undefined index 完美解决方法
- PHP Notice: undefined index 完美解决方法
- Libev事件库源码阅读笔记
- 铜川试点 ,前台ajax内部异常问题,所延伸出来的补习HTTP状态码,做个对于自己的记录
- O(1)时间求一个栈的最小值
- 误差扩散原理
- 使用stringstream 来进行string和其他类型的转换
- PHP Notice: Undefined index: ... 问题的解决方法:
- 系统状态栏显隐的控制
- eclipse鼠标变成十字架
- ios self.和下划线的区别
- activity间按钮和滑动切换,bundle传数据
- 合适的Doctype可以解决CSS失效的问题
- 简单无锁队列的实现和使用
- Android Fragment完全解析,关于碎片你所需知道的一切
- Linux开启vsftpd服务文件无法删除的解决办法