鍍金池/ 問(wèn)答/PHP  動(dòng)漫/ 請(qǐng)問(wèn)這段代碼有啥問(wèn)題?

請(qǐng)問(wèn)這段代碼有啥問(wèn)題?

為啥我遞歸遍歷,然后獲取不到值了?

public function aaaaAction() {
    $a = $this->test([],0);
    $this->newLog(__FUNCTION__,"aaa","測(cè)試",json_encode($a));
}
public function test($result,$a) {
    if($a < 200) {
        $a++;
        array_push($result,"123");
        $this->test($result,$a);
    } else {
        $ccc = $result;
        $this->newLog(__FUNCTION__,"aaa","嘿嘿嘿",json_encode($result));
        return $ccc;
    }
}
回答
編輯回答
影魅

這是PHP?
我一個(gè)菜逼前端 BB一句?
是不是 $this 指向的問(wèn)題?

2018年8月22日 21:58
編輯回答
北城荒
$this->test($result,$a);

改為

return $this->test($result,$a);
2017年1月26日 16:32