本文介绍了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,也请注意未定义的索引
发布评论