在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判断
还有一个办法就是自定一个函数,这样就直接使用函数操作
立即学习“PHP免费学习笔记(深入)”;
| 代码如下 | 复制代码 |
|
function _get($str){ |
|
调用方法
_get('str') 代替 $_GET['str'] 即可
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号