PHP:即使使用isset,也请注意未定义的索引

编程入门 行业动态 更新时间:2024-10-27 15:21:30
本文介绍了PHP:即使使用isset,也请注意未定义的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

即使使用'isset',我也能做到这一点:

i'm getting this even using 'isset':

Notice: Undefined index

它在以下位置给出错误:

it's giving the error at:

returnifisset($_COOKIE["miceusername"], ' value="', '"');

即使我正在检查cookie是否已设置.功能是:

even though i am checking if the cookie isset or not. The function is:

function returnifisset($variable, $first = '', $last = ''){ if(isset($variable) and !empty($variable)){ return $first.$variable.$last; } }

我应该如何修改此功能以使其正常工作,而不给出该错误!

how i should modify this function to make it work and not give that error!

推荐答案

您实际上是在调用isset之前通过将其与函数一起传递来访问变量的.您无法解决这个问题.

You are actually accessing the variable by passing it with your function, before the isset is ever called. You can't solve this problem.

更多推荐

PHP:即使使用isset,也请注意未定义的索引

本文发布于:2023-10-11 17:41:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1482380.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:也请   索引   未定义   PHP   isset

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!