首页 >后端开发 >php教程 >fleaphp rolesNameField bug解决方法_PHP

fleaphp rolesNameField bug解决方法_PHP

WBOY
WBOY原创
2016-06-01 12:16:33926浏览
复制代码 代码如下:
function fetchRoles($user)
{
if ($this->existsLink($this->rolesField)) {
$link =& $this->getLink($this->rolesField);
$rolenameField = $link->assocTDG->rolesNameField;
} else {
$rolenameField = 'rolename';
}

if (!isset($user[$this->rolesField]) ||
!is_array($user[$this->rolesField])) {
return array();
}
$roles = array();
foreach ($user[$this->rolesField] as $role) {
if (!is_array($role)) {
return array($user[$this->rolesField][$rolenameField]);
}
$roles[] = $role[$rolenameField];
}
return $roles;
}

在页面中定义了rolesNameField 也无效,因此在下面这段后面加多一行
复制代码 代码如下:
$rolenameField = $link->assocTDG->rolesNameField;

复制代码 代码如下:
$rolenameField = $rolenameField ? $rolenameField : 'rolename';
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn