【发布时间】:2019-11-11 10:16:24
【问题描述】:
我想缓存一个也有闭包的数组。
我试过了:
- serialize() - 不能序列化闭包
- json_encode() - 用空值替换闭包
- base64_encode() - 不接受数组
缓存包含闭包的数组还需要做什么?
【问题讨论】:
-
但是 php "from the box" 不允许闭包序列化。您只能使用 3rd 方库来达到您的目的。 php.net/manual/ru/function.serialize.php#113305
-
没有原生的方法来序列化闭包。 stackoverflow.com/questions/13734224/…
标签: php arrays caching closures callable