Php 显示特定分支并隐藏其他分支(jstree)

Php 显示特定分支并隐藏其他分支(jstree),php,jquery,mysql,jstree,Php,Jquery,Mysql,Jstree,首先,感谢您的贡献。 我在PHP和Mysql中使用JStree,我想显示一个特定的分支(我解释,我想将它用作菜单,每个用户都有自己的列表) 我是Jquery的初学者,不知道如何使用或修改它。 再次感谢你 我使用vakarta avec class.tree.php et class.db.php的代码 $('#tree') .jstree({ 'core' : { 'data' : {

首先,感谢您的贡献。 我在PHP和Mysql中使用JStree,我想显示一个特定的分支(我解释,我想将它用作菜单,每个用户都有自己的列表) 我是Jquery的初学者,不知道如何使用或修改它。 再次感谢你

我使用vakarta avec class.tree.php et class.db.php的代码

$('#tree')
            .jstree({
                'core' : {
                    'data' : {
                        'url' : '../php/TreeEvent.php?operation=get_node',
                        'data' : function (node) {
                            return { 'id' : node.id };
                        }
                    },
                    'check_callback' : true,
                    'themes' : {
                        'responsive' : false,
                        "rtl": true,
                        "theme" : "default-rtl",
                        "icons" : true
                    }
                },

                'force_text' : true,
                'plugins' : ['state','dnd','contextmenu','changed']
            })
易码PHP

if(isset($_GET['operation'])) {
$fs = new tree(db::get('mysqli://root:mdp@127.0.0.1/db_test'), array('structure_table' => 'tree_struct', 'data_table' => 'tree_data', 'data' => array('nm')));
    try {
    $rslt = null;
    switch($_GET['operation']) {
        case 'analyze':
            var_dump($fs->analyze(true));
            die();
            break;
        case 'get_node':
            $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0;
            $temp = $fs->get_children($node);
            $rslt = array();
            foreach($temp as $v) {
                $rslt[] = array('id' => $v['id'], 'text' => $v['nm'], 'children' => ($v['rgt'] - $v['lft'] > 1));
            }
            break;
        case "get_content":
            $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : 0;
            $node = explode(':', $node);
            if(count($node) > 1) {
                $rslt = array('content' => 'Multiple selected');
            }
            else {
                $temp = $fs->get_node((int)$node[0], array('with_path' => true));
                $rslt = array('content' => '->' . implode('/',array_map(function ($v) { return $v['nm']; }, $temp['path'])). '/'.$temp['nm']);
            }
            break;

你能展示你现在拥有的代码吗?在没有看到当前上下文的情况下,包括代码的相关部分和示例数据,除了含糊不清的建议之外,我真的不可能给你任何东西。我添加了一条评论。我发布了一条类似的评论。你能看到吗?你能展示你现在的代码吗?没有看到当前的上下文,包括代码的相关部分和示例数据,除了含糊不清的建议之外,我真的不可能给你任何东西。我加了一条评论。我贴了一条类似的评论。你能看一下吗?