PHP code example of guirong / php-closure

1. Go to this page and download the library: Download guirong/php-closure library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

guirong / php-closure example snippets


composer 

\Guirong\PhpClosure\ClosureSerialize::serialize($closure_data);

\Guirong\PhpClosure\serialize($closure_data);

\Guirong\PhpClosure\ClosureSerialize::unserialize($serialize_data,$options);

\Guirong\PhpClosure\unserialize($serialize_data,$options);


//base64 序列化转码
$serialize_data = base64_encode(
    \Guirong\PhpClosure\ClosureSerialize::serialize($closure_data)
);

file_put_contents('clourse.txt',$serialize_data);

$serialize_data = file_get_contents('clourse.txt');

//base64 序列化解码
$closure_data = \Guirong\PhpClosure\ClosureSerialize::unserialize(
    base64_decode($serialize_data),$options
);