php的http协议怎么使用

2025-05-12 15:44:12

1、采集远程文件/** * 采集远程文件 * * @access public * @param string $remote * 远程文件名 * @param string $local * 本地保存文件名 * @return mixed */ static public function curlDownload($remote, $local) { $cp = curl_init ( $remote ); $fp = fopen ( $local, "w" ); curl_setopt ( $cp, CURLOPT_FILE, $fp ); curl_setopt ( $cp, CURLOPT_HEADER, 0 ); curl_exec ( $cp ); curl_close ( $cp ); fclose ( $fp ); }

php的http协议怎么使用php的http协议怎么使用php的http协议怎么使用

4、// 发送Http Header信息 开始下载 header ( "Pragma: public" ); header ( "Cache-control: max-age=" . $expire ); // header('Cache-Control: no-store, no-cache, must-revalidate'); header ( "Expires: " . gmdate ( "D, d M Y H:i:s", time () + $expire ) . "GMT" ); header ( "Last-Modified: " . gmdate ( "D, d M Y H:i:s", time () ) . "GMT" ); header ( "Content-Disposition: attachment; filename=" . $showname ); header ( "Content-Length: " . $length ); header ( "Content-type: " . $type ); header ( 'Content-Encoding: none' ); header ( "Content-Transfer-Encoding: binary" ); if ($content == '') { readfile ( $filename ); } else { echo ($content); } exit (); }

php的http协议怎么使用
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢