PHP Notice: undefined index原因与解决方法
发布时间:2023-02-28 13:24:34 所属栏目:PHP教程 来源:
导读:在PHP开发时可能会碰到如PHP Notice: undefined index这种错误提示,下面我来给大家介绍关于undefined index错误提示的解决办法。
如 $_GET['aa']; 就会出现PHP Notice: undefined index ‘aa&lsquo
如 $_GET['aa']; 就会出现PHP Notice: undefined index ‘aa&lsquo
|
在PHP开发时可能会碰到如PHP Notice: undefined index这种错误提示,下面我来给大家介绍关于undefined index错误提示的解决办法。 如 $_GET['aa']; 就会出现PHP Notice: undefined index ‘aa‘了。 下面我来总结出现PHP Notice: undefined index 解决办法。 1、PHP.ini配置文件,error_reporting = E_ALL & ~E_NOTICE 2、加个isset函数 isset($_GET["page"]) if-else判断 还有一个办法就是自定一个函数,这样就直接使用函数操作: function _get($str){ $val = !empty($_GET[$str]) ? $_GET[$str] : null; return $val; } 调用方法: _get('str') 代替$_GET['str'] 即可 (编辑:汽车网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
