如何用PHP下载swf文件 已知一个swf文件地址,如:http://www.abc.com/1.swf如何通过用php写代码自动下载这个swf呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <? header("content-type:text/html; charset=utf-8"); $file_name=$_GET['name']; //服务器的真实文件名 $file_realName=urldecode($_GET['real']); //数据库的文件名urlencode编码过的$file_dir="upload/";$file = fopen($file_dir . $file_name,"r"); // 打开文件// 输入文件标签header( "Pragma: public" );header( "Expires: 0" );Header("Content-type: application/octet-stream");Header("Accept-Ranges: bytes");Header("Accept-Length: ".filesize($file_dir . $file_name));Header("Content-Disposition: attachment; filename=" . iconv("UTF-8","GB2312//TRANSLIT",$file_realName));// 输出文件内容echo fread($file,filesize($file_dir . $file_name));fclose($file);exit;?>网上很多,随便摘了一个 <?php$handle=fopen("http://www.abc.com/1.swf","r");$save_handle=fopen("ok.swf","w");$content="";while(!feof($handle)){ $content.=fread($handle,1024);}fwrite($save_handle,$content);?>不过前提是对方服务器不检测来源,不禁止直接访问什么的。否则还要伪装。 <?php$file_path = 'http://player.youku.com/player.php/partnerid/XOTcy/sid/XMTU4OTk5MTY0/v.swf';$file_name = 'v.swf';$file_size = filesize($file_path);header ( "Pragma: public" );header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );header ( "Cache-Control: private", false );header ( "Content-Transfer-Encoding: binary" );header ( "Content-Type:application/x-shockwave-flash");header ( "Content-Length: " . $file_size);header ( "Content-Disposition: attachment; filename=".$file_name);echo(file_get_contents($file_path));exit;?> 这些参数如何设置? 链接中写&的原因是什么? Cannot modify header information 我要实现一个模糊查询 从4个表里查询! 查询问题 修改信息成功后内容未变 这样的查询如何实现 类似QQ这样的放号程序,怎么实现? 如何把内容输出到文件上面 请问,现在做网站大都有后台的吗?是不是用后台来管理网站比较容易?没用过! 注册页面碰到难题》》》》》》。。。。 MYSql查询的时候如可将一个不是唯一的字段的各个值统计出来,在一行显示。(因为要做排序)请教SQL语句用得好的。谢谢
header("content-type:text/html; charset=utf-8");
$file_name=$_GET['name']; //服务器的真实文件名
$file_realName=urldecode($_GET['real']); //数据库的文件名urlencode编码过的
$file_dir="upload/";
$file = fopen($file_dir . $file_name,"r"); // 打开文件
// 输入文件标签
header( "Pragma: public" );
header( "Expires: 0" );
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".filesize($file_dir . $file_name));
Header("Content-Disposition: attachment; filename=" . iconv("UTF-8","GB2312//TRANSLIT",$file_realName));
// 输出文件内容
echo fread($file,filesize($file_dir . $file_name));
fclose($file);
exit;
?>网上很多,随便摘了一个
<?php
$handle=fopen("http://www.abc.com/1.swf","r");
$save_handle=fopen("ok.swf","w");
$content="";
while(!feof($handle)){
$content.=fread($handle,1024);
}
fwrite($save_handle,$content);
?>
不过前提是对方服务器不检测来源,不禁止直接访问什么的。
否则还要伪装。
$file_name = 'v.swf';
$file_size = filesize($file_path);header ( "Pragma: public" );
header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
header ( "Cache-Control: private", false );
header ( "Content-Transfer-Encoding: binary" );
header ( "Content-Type:application/x-shockwave-flash");
header ( "Content-Length: " . $file_size);
header ( "Content-Disposition: attachment; filename=".$file_name);echo(file_get_contents($file_path));
exit;?>