如何在 php 中缓存闭包

How to cache closures in php

我想缓存一个也有闭包的数组。

我试过:

缓存也包含闭包的数组还需要做什么?

PHP 中的闭包无法序列化 "from the box" 因此数组也包含闭包。您只能使用第 3 方 ways/libraries 来达到此目的。 此处讨论:Serializing anonymous functions in php