PHP code example of edwardstock / spork
1. Go to this page and download the library: Download edwardstock/spork 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/ */
edwardstock / spork example snippets
$manager = new Spork\ProcessManager();
$manager->fork(function() {
// do something in another process!
return 'Hello from '.getmypid();
})->then(function(Spork\Fork $fork) {
// do something in the parent process when it's done!
echo "{$fork->getPid()} says '{$fork->getResult()}'\n";
});
$files = new RecursiveDirectoryIterator('/path/to/images');
$files = new RecursiveIteratorIterator($files);
$manager->process($files, function(SplFileInfo $file) {
// upload this file
});