在 PHP 中,可以使用 file_put_contents() 函数来创建文件。

<?php
$file = 'file.txt';
$content = 'Hello, World!';

// 创建文件并写入内容
file_put_contents($file, $content);

echo '文件创建成功!';
?>

上述代码会创建一个名为 file.txt 的文件,并在其中写入 Hello, World! 的内容。

PHP 创建文件:使用 file_put_contents() 函数

原文地址: https://www.cveoy.top/t/topic/fOj2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录