gpt4 book ai didi

php - 检查文件是否存在并且大于

转载 作者:行者123 更新时间:2023-12-02 06:16:26 27 4
gpt4 key购买 nike

我需要检查与脚本位于同一文件夹中的文件是否存在并且大于 100 字节,如果是,则回显“存在”。

最佳答案

我相信你正在尝试做这样的事情:

$filename = 'test.txt';

if (file_exists($filename) && filesize($filename) > 100) {
echo "is there";
} else {
echo "not there";
}

阅读 filesize 的 PHP 文档和 file_exists以获得更深入的解释。

关于php - 检查文件是否存在并且大于,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19600666/

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