fork download
  1. <?php
  2.  
  3. $data = '{"id":3,"nome":"teste","tree_funcao":"a:7:{i:0;a:9:{s:2:\"id\";s:1:\"1\";s:4:\"text\";s:9:\"Dashboard\";s:4:\"icon\";s:23:\"fa fa-folder text-osun\";s:7:\"li_attr\";O:8:\"stdClass\":1:{s:2:\"id\";s:1:\"1\";}s:6:\"a_attr\";O:8:\"stdClass\":2:{s:4:\"href\";s:1:\"#\";s:2:\"id\";s:8:\"1_anchor\";}s:5:\"state\";O:8:\"stdClass\":4:{s:6:\"loaded\";b:1;s:6:\"opened\";b:0;s:8:\"selected\";b:1;s:8:\"disabled\";b:0;}s:4:\"data\";O:8:\"stdClass\":0:{}s:6:\"parent\";s:1:\"#\";s:4:\"type\";s:5:\"grupo\";}i:1;a:9:{s:2:\"id\";s:1:\"2\";s:4:\"text\";s:14:\"Configura\u00e7\u00e3o\";s:4:\"icon\";s:23:\"fa fa-folder text-osun\";s:7:\"li_attr\";O:8:\"stdClass\":1:{s:2:\"id\";s:1:\"2\";}s:6:\"a_attr\";O:8:\"stdClass\":2:{s:4:\"href\";s:1:\"#\";s:2:\"id\";s:8:\"2_anchor\";}s:5:\"state\";O:8:\"stdClass\":4:{s:6:\"loaded\";b:1;s:6:\"opened\";b:0;s:8:\"selected\";b:1;s:8:\"disabled\";b:0;}s:4:\"data\";O:8:\"stdClass\":0:{}s:6:\"parent\";s:1:\"#\";s:4:\"type\";s:5:\"grupo\";}i:2;a:9:{s:2:\"id\";s:1:\"3\";s:4:\"text\";s:8:\"Usu\u00e1rio\";s:4:\"icon\";s:34:\"fa fa-angle-double-right text-osun\";s:7:\"li_attr\";O:8:\"stdClass\":1:{s:2:\"id\";s:1:\"3\";}s:6:\"a_attr\";O:8:\"stdClass\":2:{s:4:\"href\";s:1:\"#\";s:2:\"id\";s:8:\"3_anchor\";}s:5:\"state\";O:8:\"stdClass\":4:{s:6:\"loaded\";b:1;s:6:\"opened\";b:0;s:8:\"selected\";b:1;s:8:\"disabled\";b:0;}s:4:\"data\";O:8:\"stdClass\":0:{}s:6:\"parent\";s:1:\"2\";s:4:\"type\";s:6:\"funcao\";}i:3;a:9:{s:2:\"id\";s:1:\"4\";s:4:\"text\";s:5:\"Criar\";s:4:\"icon\";s:20:\"fa fa-lock text-osun\";s:7:\"li_attr\";O:8:\"stdClass\":1:{s:2:\"id\";s:1:\"4\";}s:6:\"a_attr\";O:8:\"stdClass\":1:{s:4:\"href\";s:1:\"#\";}s:5:\"state\";O:8:\"stdClass\":4:{s:6:\"loaded\";b:1;s:6:\"opened\";b:0;s:8:\"selected\";b:1;s:8:\"disabled\";b:0;}s:4:\"data\";O:8:\"stdClass\":0:{}s:6:\"parent\";s:1:\"3\";s:4:\"type\";s:4:\"acao\";}i:4;a:9:{s:2:\"id\";s:1:\"5\";s:4:\"text\";s:6:\"Editar\";s:4:\"icon\";s:20:\"fa fa-lock text-osun\";s:7:\"li_attr\";O:8:\"stdClass\":1:{s:2:\"id\";s:1:\"5\";}s:6:\"a_attr\";O:8:\"stdClass\":1:{s:4:\"href\";s:1:\"#\";}s:5:\"state\";O:8:\"stdClass\":4:{s:6:\"loaded\";b:1;s:6:\"opened\";b:0;s:8:\"selected\";b:1;s:8:\"disabled\";b:0;}s:4:\"data\";O:8:\"stdClass\":0:{}s:6:\"parent\";s:1:\"3\";s:4:\"type\";s:4:\"acao\";}i:5;a:9:{s:2:\"id\";s:1:\"6\";s:4:\"text\";s:7:\"Excluir\";s:4:\"icon\";s:20:\"fa fa-lock text-osun\";s:7:\"li_attr\";O:8:\"stdClass\":1:{s:2:\"id\";s:1:\"6\";}s:6:\"a_attr\";O:8:\"stdClass\":1:{s:4:\"href\";s:1:\"#\";}s:5:\"state\";O:8:\"stdClass\":4:{s:6:\"loaded\";b:1;s:6:\"opened\";b:0;s:8:\"selected\";b:1;s:8:\"disabled\";b:0;}s:4:\"data\";O:8:\"stdClass\":0:{}s:6:\"parent\";s:1:\"3\";s:4:\"type\";s:4:\"acao\";}i:6;a:9:{s:2:\"id\";s:1:\"8\";s:4:\"text\";s:10:\"Visualizar\";s:4:\"icon\";s:20:\"fa fa-lock text-osun\";s:7:\"li_attr\";O:8:\"stdClass\":1:{s:2:\"id\";s:1:\"8\";}s:6:\"a_attr\";O:8:\"stdClass\":1:{s:4:\"href\";s:1:\"#\";}s:5:\"state\";O:8:\"stdClass\":4:{s:6:\"loaded\";b:1;s:6:\"opened\";b:0;s:8:\"selected\";b:1;s:8:\"disabled\";b:0;}s:4:\"data\";O:8:\"stdClass\":0:{}s:6:\"parent\";s:1:\"3\";s:4:\"type\";s:4:\"acao\";}}","grupo_id":1}';
  4.  
  5. $data_array = json_decode ($data, TRUE);
  6. $tree_funcao = unserialize ($data_array['tree_funcao']);
  7.  
  8. print_r($tree_funcao);
Success #stdin #stdout 0.02s 23632KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [id] => 1
            [text] => Dashboard
            [icon] => fa  fa-folder text-osun
            [li_attr] => stdClass Object
                (
                    [id] => 1
                )

            [a_attr] => stdClass Object
                (
                    [href] => #
                    [id] => 1_anchor
                )

            [state] => stdClass Object
                (
                    [loaded] => 1
                    [opened] => 
                    [selected] => 1
                    [disabled] => 
                )

            [data] => stdClass Object
                (
                )

            [parent] => #
            [type] => grupo
        )

    [1] => Array
        (
            [id] => 2
            [text] => Configuração
            [icon] => fa  fa-folder text-osun
            [li_attr] => stdClass Object
                (
                    [id] => 2
                )

            [a_attr] => stdClass Object
                (
                    [href] => #
                    [id] => 2_anchor
                )

            [state] => stdClass Object
                (
                    [loaded] => 1
                    [opened] => 
                    [selected] => 1
                    [disabled] => 
                )

            [data] => stdClass Object
                (
                )

            [parent] => #
            [type] => grupo
        )

    [2] => Array
        (
            [id] => 3
            [text] => Usuário
            [icon] => fa fa-angle-double-right text-osun
            [li_attr] => stdClass Object
                (
                    [id] => 3
                )

            [a_attr] => stdClass Object
                (
                    [href] => #
                    [id] => 3_anchor
                )

            [state] => stdClass Object
                (
                    [loaded] => 1
                    [opened] => 
                    [selected] => 1
                    [disabled] => 
                )

            [data] => stdClass Object
                (
                )

            [parent] => 2
            [type] => funcao
        )

    [3] => Array
        (
            [id] => 4
            [text] => Criar
            [icon] => fa fa-lock text-osun
            [li_attr] => stdClass Object
                (
                    [id] => 4
                )

            [a_attr] => stdClass Object
                (
                    [href] => #
                )

            [state] => stdClass Object
                (
                    [loaded] => 1
                    [opened] => 
                    [selected] => 1
                    [disabled] => 
                )

            [data] => stdClass Object
                (
                )

            [parent] => 3
            [type] => acao
        )

    [4] => Array
        (
            [id] => 5
            [text] => Editar
            [icon] => fa fa-lock text-osun
            [li_attr] => stdClass Object
                (
                    [id] => 5
                )

            [a_attr] => stdClass Object
                (
                    [href] => #
                )

            [state] => stdClass Object
                (
                    [loaded] => 1
                    [opened] => 
                    [selected] => 1
                    [disabled] => 
                )

            [data] => stdClass Object
                (
                )

            [parent] => 3
            [type] => acao
        )

    [5] => Array
        (
            [id] => 6
            [text] => Excluir
            [icon] => fa fa-lock text-osun
            [li_attr] => stdClass Object
                (
                    [id] => 6
                )

            [a_attr] => stdClass Object
                (
                    [href] => #
                )

            [state] => stdClass Object
                (
                    [loaded] => 1
                    [opened] => 
                    [selected] => 1
                    [disabled] => 
                )

            [data] => stdClass Object
                (
                )

            [parent] => 3
            [type] => acao
        )

    [6] => Array
        (
            [id] => 8
            [text] => Visualizar
            [icon] => fa fa-lock text-osun
            [li_attr] => stdClass Object
                (
                    [id] => 8
                )

            [a_attr] => stdClass Object
                (
                    [href] => #
                )

            [state] => stdClass Object
                (
                    [loaded] => 1
                    [opened] => 
                    [selected] => 1
                    [disabled] => 
                )

            [data] => stdClass Object
                (
                )

            [parent] => 3
            [type] => acao
        )

)