otice(8):未定义的变量:用户[APP / Template / Layout / default.ctp,第102行]
通知(8):尝试获取非对象[APP / Template / Layout / default.ctp,第102行]的属性“ id”
<?php`enter code here`
if ($auth){
$currentViewDetails = strtolower($inflector::singularize($this->name)); //=user
//check if is a user model
if(isset($$currentViewDetails->user_id)){
$currentViewDetailsId = $$currentViewDetails->user_id;
}
if($currentViewDetails == 'User'){
$currentViewDetailsId = $$currentViewDetails->id;
}
//check if user is Authorized
$isUserAuthorized = false;
if(isset($$currentViewDetailsId) or $$currentViewDetails->id == $auth['User']['id']){
$isUserAuthorized = true;
}
echo $this->element('sidemenus/side_menu_login',['viewName'=> $inflector::singularize($this->name),'isUserAuthorized'=>$isUserAuthorized]);
}else{
echo $this->element('sidemenus/side_menu_logout');
} ?>
<?= $this->fetch('content') ?>
Notice (8): Undefined variable: user [APP/Template/Layout/default.ctp, line 102]
Notice (8): Trying to get property 'id' of non-object [APP/Template/Layout/default.ctp, line 102]