美文网首页
PHP Notice: undefined index 完美解决

PHP Notice: undefined index 完美解决

作者: a6217200e10d | 来源:发表于2018-10-31 16:53 被阅读0次

PHP Notice: undefined index 完美解决方法

在使用 $_SESSION[$openid] 语句时,提示:Notice: undefined index

有的是在使用 $_GET['u']; 时,提示:Notice: undefined index

简单的解决办法:加一个 empty 方法/函数 判断一下就ok了。

empty($_SESSION[$openid])

empty($_GET['u'])

你也可以试试以下方法:

警告:我没试过!

<?php

//禁用错误报告

error_reporting(0);

//报告除了警告以外的所有错误

error_reporting(E_ALL & ~E_NOTICE);

//报告运行时错误

error_reporting(E_ERROR | E_WARNING | E_PARSE);

//报告所有错误

error_reporting(E_ALL);

?>

本文地址:https://www.jianshu.com/p/052e1ad2e900

相关文章

网友评论

      本文标题:PHP Notice: undefined index 完美解决

      本文链接:https://www.haomeiwen.com/subject/hrzbtqtx.html