illustrate
1. Automatically called when serialize() is called outside the class.
2. The __sleep() method is usually used to submit uncommitted data or similar cleaning operations. This feature is useful if you have some large objects but don't need to save them completely.
Example
Output: Using the default text output, the message format is: MESSAGE_TYPE: LINE_NUM:[OBJECT:] MESSAGE There are 5 kinds of message types : * (C) convention, for programming standard violation * (R) refactor, for bad code smell * (W) warning, for python specific problems * (E) error, for probable bugs in the code * (F) fatal, if an error occurred which prevented pylint from doing further processing.
The above is the use of __sleep method in php, I hope it will be helpful to everyone.