php4如何获取远程文件大小类
php5有get_headers非常好用,因为他可以直接读取远程文件的信息,而不用把整个文件读取到服务器。但是现在很多web服务器都不支持php5,下面我们就来看一个关于php4获取远程服务器文件大小的实例类吧。
php教程4如何获取远程文件大小类
/*
php5有get_headers非常好用,因为他可以直接读取远程文件的信息,而不用把整个文件读取到服务器。但是现在很多web服务器都不支持php5,下面我们就来看一个关于php4获取远程服务器文件大小的实例类吧。
*/
if(!function_exists('get_headers'))
{
function get_headers($url,$format=0)
{
$url=parse_url($url);
$end = "rnrn";
$fp = fsockopen($url['host'], (empty($url['port'])?80:$url['port']), $errno, $errstr, 30);
if ($fp)
{
$out = "get / http/1.1rn";
$out .= "host: ".$url['host']."rn";
$out .= "connection: closernrn";
$var = '';
fwrite($fp, $out);
while (!feof($fp))
{
$var.=fgets($fp, 1280);
if(strpos($var,$end))
break;
}
fclose($fp);$var=preg_replace("/rnrn.*$/",'',$var);
$var=explode("rn",$var);
if($format)
{
foreach($var as $i)
{
if(preg_match('/^([a-za-z -]+): +(.*)$/',$i,$parts))
$v[$parts[1]]=$parts[2];
}
return $v;
}
else
return $var;
}
}
}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Linux new version
SublimeText3 Linux latest version

Zend Studio 13.0.1
Powerful PHP integrated development environment