gpt4 book ai didi

php - 创建一个 php 文件

转载 作者:行者123 更新时间:2023-12-02 15:39:17 25 4
gpt4 key购买 nike

有没有脚本可以在指定目录下生成文件?喜欢

<?php

createfile("hi.txt","/home/public_html/files");

?>

最佳答案

您可以使用 file_put_contents .

<?php

file_put_contents("/home/public_html/files/hi.txt", "content");

?>

touch如果您不需要内容而只是想确保文件已创建:

<?php

touch("/home/public_html/files/hi.txt");

?>

关于php - 创建一个 php 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10768627/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com