thinkphp5.0ページングコールバック処理eachメソッドにエラーがあります

859 ワード

TP 5,eachメソッドコードthinkphp/library/think/Collection.php (each)
/**
     *           
     *
     * @param  callable $callback
     * @return $this
     */
    public function each(callable $callback)
    {
        foreach ($this->items as $key => $item) {
              if ($callback($item, $key) === false) {
                break;
            }
        }        
        return $this;
    }

foreach内は$this値に影響しません.
コードの変更:
public function each(callable $callback)
    {
        foreach ($this->items as $key => $item) {
            $this->items[$key] = $callback($item, $key);
            if ($callback($item, $key) === false) {
                break;
            }
        }
        
        return $this;
    }

質問があればグループ162092974に問い合わせてください.