欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

fleaphp rolesNameField bug解决方法_PHP教程

程序员文章站 2022-04-20 14:09:23
...
复制代码 代码如下:

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';

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/323252.htmlTechArticle复制代码 代码如下: function fetchRoles($user) { if ($this-existsLink($this-rolesField)) { $link = $this-getLink($this-rolesField); $rolenameField = $link-assocTDG-rolesName...