使用set :: class实用程序提取数组

时间:2010-03-19 19:07:27

标签: cakephp

有没有办法使用set :: class utiliy为指定的id提取数组?我无法弄清楚XPath。

即。我想提取id = 1

的数组
[Document] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [filename] => 1.txt
                )

            [1] => Array
                (
                    [id] => 2
                    [filename] => 2.txt
                )

            [2] => Array
                (
                    [id] => 3
                    [filename] => 3.txt
                )


        )

1 个答案:

答案 0 :(得分:1)

尝试:

Set :: extract('/ [id = 1]',$ data ['Document']);

Set :: extract('/ [id = 1] / ..',$ data ['Document']);