/*** * 斐波那契数递归法,f(n) = f(n-1) + f(n-2) */ function fib($n) { if ($n < 2) { return 1; } else { return $this->fib($n - 1) + $this->fib($n - 2); } }