level 1
Ruifly
楼主

这个是表内容<?php
$mysqli = new mysqli("localhost","root","root","jquery_demo");
if($mysqli->connect_error){
die("Connect Error");
}
$mysqli->query("set names utf8");
$query="select * from ztree_menu";
if($result = $mysqli->query($query)){
$arr=array();
while($row=$result->fetch_assoc()){
array_push($arr, array('id' => $row['id'], 'pId' => $row['pId'], 'name' => $row['name'], 'isParent'=>true));
}
$result->free();
}
$mysqli->close();
$json_arr=json_encode($arr);
header("Content-Type:text/json");
echo $json_arr;
上面是php代码生成用son_encode将数组转换成json格式
var setting_json = {
async: {
enable: true,
url:"../asyncData/ZZgetNodes.php"
}
};
html就用了上面这些
这么显示admin是一级 其他都是二级的样子
对autoParam ,otherParam不理解啊
希望多些通过数据库动态加载的例子
