PHP Filesize: Get File Size in Bytes

In PHP, you can use the filesize() function to retrieve the size of a file. This function takes an argument, which is the file path, and returns the size of the file in bytes.

Here is an example:

$file = 'path/to/file.txt';
$fileSize = filesize($file);

echo '文件大小:' . $fileSize . '字节';

Please note that the filesize() function only works for local files and not for remote files. If you need to obtain the size of a remote file, you can use the curl library or other relevant functions.

bannerAds