php往u盘里写入文件

<?php
$a=disk_free_space("F:");		//返回目录中的可用空间
$size=filesize("I:/1.txt");		//获取I盘里的1.txt文件
for($i=0;$i<500;)
{
	for($j=0;$j<1000;$j++)
	{
		$name=time();
		//39121615872大概是4G
		if(disk_free_space("I:")<39121615872)
		{
			break;
		}
		//往U盘里写入文件
		file_put_contents("I:".$name.$j,$a);
	}
}

disk_free_space: 返回目录中的可用空间

disk_total_space:返回磁盘空间中的总大小

返回的值以字节数为单位

猜你喜欢

转载自blog.csdn.net/qq_42249896/article/details/86501874