Home> php教程> php手册> body text

fleaphp rolesNameField bug解决方法

WBOY
Release: 2016-06-13 12:10:07
Original
1329 people have browsed it

复制代码代码如下:


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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!