Created
May 7, 2021 12:33
-
-
Save carliedu/620595f24b404ec44485c331618935ab to your computer and use it in GitHub Desktop.
Get the result of file exist/no exits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use app\clFilesystem; | |
use React\MySQL\Factory; | |
require __DIR__ . '/vendor/autoload.php'; | |
$loop = React\EventLoop\Factory::create(); | |
$filesystem = \React\Filesystem\Filesystem::create($loop); | |
$file = "teste.txt"; | |
echo 'The file ['.$file.'] ['.f_existsFile($filesystem, $file)."]\n"; | |
$loop->stop(); | |
//----- Final do LOOP | |
$loop->run(); | |
// F U N C T I O N //////////////////////////////////////////////////// | |
function f_existsFile($filesystem, $file) | |
{ | |
$filesystem->file($file)->exists()->then(function () { | |
return 'exists'; | |
}, function () { | |
return 'was not found'; | |
}); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment