fleaphp rolesNameField bug解决方法

前端之家收集整理的这篇文章主要介绍了fleaphp rolesNameField bug解决方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="25512" class="copybut" id="copybut25512" onclick="doCopy('code25512')"> 代码如下:

<div class="codebody" id="code25512">
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 也无效,因此在下面这段后面加多一行
<div class="codetitle"><a style="CURSOR: pointer" data="17226" class="copybut" id="copybut17226" onclick="doCopy('code17226')"> 代码如下:
<div class="codebody" id="code17226">
$rolenameField = $link->assocTDG->rolesNameField;

<div class="codetitle"><a style="CURSOR: pointer" data="95200" class="copybut" id="copybut95200" onclick="doCopy('code95200')"> 代码如下:
<div class="codebody" id="code95200">
$rolenameField = $rolenameField ? $rolenameField : 'rolename';

原文链接:https://www.f2er.com/php/28023.html
bugbugrolesNameField

猜你在找的PHP相关文章