异步文件系统IO

建议先阅读官方文档异步文件系统IO章节

示例:

异步读文件

<?php
$content = date("Ymd H:i:s").PHP_EOL;
swoole_async_writefile(__DIR__."/1.log", $content, function($filename){
    // todo
    echo "success".PHP_EOL;
}, FILE_APPEND);
echo "start".PHP_EOL;

异步写文件

$content = date("Ymd H:i:s").PHP_EOL;
swoole_async_writefile(__DIR__."/1.log", $content, function($filename){
    // todo
    echo "success".PHP_EOL;
}, FILE_APPEND);
echo "start".PHP_EOL;

Last updated