PHP头条
热点:

php提示undefined index解决方法


在php开发中经常会出现undefined index这种错误提示,下面我们看看方法总结吧。

平时用$_post[''],$_get['']获取表单中参数时会出现Notice: Undefined index: --------;

服务器配置修改
修改php.ini配置文件,

 代码如下 复制代码
error_reporting = E_ALL & ~E_NOTICE

程序判断

 代码如下 复制代码

function _get($str){
$val = !empty($_GET[$str]) ? $_GET[$str] : null;
return $val;
}

还有一种方法就是在php把错误关闭了代码

 代码如下 复制代码

error_reporting(E_ALL ^ E_NOTICE);

用isset方法

 代码如下 复制代码

$var = isset($_GET['a'])?$_GET['a']:'';

www.phpzy.comtrue/php/2568.htmlTechArticlephp提示undefined index解决方法 在php开发中经常会出现undefined index这种错误提示,下面我们看看方法总结吧。 平时用$_post[''],$_get['']获取表单中参数时会出现Notice: Undefined index: --------; 服...

相关文章

    暂无相关文章
相关频道:

PHP之友评论

今天推荐