Home > Backend Development > PHP Tutorial > fleaphp rolesNameField bug solution_PHP tutorial

fleaphp rolesNameField bug solution_PHP tutorial

WBOY
Release: 2016-07-21 15:30:16
Original
945 people have browsed it

Copy code The code is as follows:

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

Defining rolesNameField in the page is also invalid, so add an extra line after the following paragraph
Copy code The code is as follows:

$rolenameField = $link->assocTDG->rolesNameField;

Copy code The code is as follows:

$rolenameField = $rolenameField ? $rolenameField : 'rolename';

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323252.htmlTechArticleCopy the code as follows: function fetchRoles($user) { if ($this-existsLink($this-rolesField) ) { $link = $this-getLink($this-rolesField); $rolenameField = $link-assocTDG-rolesName...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template