php检查文件是否有内容

2025-05-16 07:24:42
推荐回答(1个)
回答(1):

file_get_contents()

if( trim( file_get_contents( '/data/1.txt' ) ) == '' )
{
echo '文件/data/1.txt 无内容';

}