How to serialize object that has closures inside properties?

后端 未结 4 1296
面向向阳花
面向向阳花 2021-01-14 05:57

if I do serialize($obj), I get:

Serialization of \'Closure\' is not allowed

Is there any way these closures can be

4条回答
  •  花落未央
    2021-01-14 06:45

    I've written a function that allows any Exception to be serialized. This is done by flattening complex values in the backtrace.

    Source:

    https://gist.github.com/Thinkscape/805ba8b91cdce6bcaf7c

    Usage:

    getTraceAsString());
    }
    

提交回复
热议问题