php 声明下载文件代码示例


	public function getDown()
    {
        $file = fopen ( 'aa.php', "r" );
        //输入文件标签
        Header ( "Content-type: application/octet-stream" );
        Header ( "Accept-Ranges: bytes" );
        Header ( "Accept-Length: " . filesize ( 'aa.php' ) );
        Header ( "Content-Disposition: attachment; filename=aa.php"  );
        //输出文件内容
        //读取文件内容并直接输出到浏览器
        echo fread ( $file, filesize ( 'aa.php' ) );
        fclose ( $file );
        exit ();
    }

你可能感兴趣的:(php)