问题
i'm getting this even using 'isset':
Notice: Undefined index
it's giving the error at:
returnifisset($_COOKIE["miceusername"], ' value="', '"');
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!
回答1:
You are actually accessing the variable by passing it with your function, before the isset is ever called. You can't solve this problem.
回答2:
You use different function names printifisset and returnifisset. Also you can use only !empty() statement
来源:https://stackoverflow.com/questions/7096914/php-notice-undefined-index-even-using-isset