【求助】权限管理、节点管理。 提示错误!
CI框架以下是相关代码段
NodeService.php
/**
* 获取节点信息
*/
public function getNodes()
{
$nodes = $this->Adminnode_model->queryAllBySort("admin_node",array("weight"=>"desc"));
$this->tidyNode($nodes->result(),$data);
return $data;
}
/**
* 将读取出来的所有节点整理
* @param array $nodelist 节点数组
* @param arrat $data 空数组,存放整理后的数据
* @param int $pid父id
* @param int $forlevel 递归深度
*/
private function tidyNode(&$nodelist,&$data=0,$pid=0,$forlevel=0){
$forlevel++;
foreach($nodelist as $node){
if($node->pid == $pid){
$node->forlevel = $forlevel;
$data[] = $node ;
$this->tidyNode($nodelist,$data,$node->id,$forlevel);
}
}
}
AdminNode.php
/**
* 打开节点管理首页
*/
public function index()
{
$nodes=$this->NodeService->getNodes();
$this->by_smarty->assign('nodes',$nodes);
$this->by_smarty->view('admin/auth/node');
}
错误提示信息:
A PHP Error was encountered
Severity: Runtime Notice
Message: Only variables should be passed by reference
Filename: auth/NodeService.php
Line Number: 21
Backtrace:
File: C:\wamp\www\betterus\application\service\admin\auth\NodeService.php
Line: 21
Function: _error_handler
File: C:\wamp\www\betterus\application\controllers\admin\auth\AdminNode.php
Line: 21
Function: getNodes
File: C:\wamp\www\betterus\index.php
Line: 295
Function: require_once
$this 是呼叫當前 class 內的所有 function
CI 似乎沒有提供 Controller 間互相呼叫
你可以考慮寫在 Model
页:
[1]