3.2.3为什么无法运行下面这段代码 但是3.2.2就可以

浏览:363 发布日期:2015/04/07 分类:求助交流
$m = M('department'); /* 不能删除 */

/* 无限分类 */
function getList($pid = 0, &$result = array(), $spac = 0)
{

//因为是登陆状态,所以通过session来获得shopid
$shopid = session('shopid');

$spac = $spac + 8;
$sql = "SELECT * FROM chi_department WHERE department_pid=$pid AND department_shopid=$shopid order by department_sort";
$res = mysql_query($sql);
while ($row = mysql_fetch_assoc($res)) {
$row['department_oldname'] = $row['department_name'];
$row['department_name'] = str_repeat(' ', $spac) . '|--' . $row['department_name'];
$result[] = $row;
getList($row['department_id'], $result, $spac);
}
return $result;
}

dump(getList());
最佳答案
评论( 相关
后面还有条评论,点击查看>>