This commit is contained in:
2020-09-03 18:37:13 +08:00
parent 39f17a1c2e
commit 12461e6750
+6 -6
View File
@@ -131,16 +131,16 @@ class Snowflake
/** /**
* @param $fileName * @param $fileName
* @param $content * @param $content
* @param int $is_append * @param null $is_append
* @return false|int|mixed * @return false|int|mixed
*/ */
public static function writeFile($fileName, $content, $is_append = FILE_APPEND) public static function writeFile($fileName, $content, $is_append = null)
{ {
if (self::inCoroutine()) { $params = [$fileName, $content];
return Coroutine::writeFile($fileName, $content, $is_append); if ($is_append !== null) {
} else { $params[] = $is_append;
return file_put_contents($fileName, $content, $is_append);
} }
return !self::inCoroutine() ? file_put_contents(...$params) : Coroutine::writeFile(...$params);
} }