|
CI框架
以下是相关代码段
NodeService.php
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
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
|
|