0

タイトルが示唆しているように、関数があります。配列にいくつかの変更を加えます(この配列は私のパラメータです)。次に、実際の配列のコピーを使用していることに気付きました。

コピーではなく実際の配列を取得する方法があったことは知っていますが、それは何でしたか? 事前にすべてありがとう、私はあなたがこれをすぐに解決することを知っています:)

使っているところはこちら

function findChildren($listOfParents)
    {
        static $depth=-1;
        $depth++;

        foreach ($listOfParents as $thisParent)
        {
            $thisParent->title = str_repeat(" >", $depth) . $thisParent->title;
            $children = page::model()->findAll(array('condition'=>'parent = ' . $thisParent->id));
            findChildren($children);
        }

        $depth--;
    }

したがって、彼のコピーではなく、この $listOfParents が必要です。

4

3 に答える 3

1

参照によって渡します

function funcName (array &$param)
{
    // Do work here
}
于 2012-05-11T15:32:26.780 に答える