3 05 2011

PHP 创建并让文件强制下载

bigCat Posted in PHP - Comment.isBlank
<?php\r\n//$name = trim($_SERVER['PATH_INFO'],'/');\r\n//$rs = @file_get_contents('http://miao.in/ipq.php');\r\n$love_filename= $_POST["filename"];\r\n$love_maker= $_POST["content"];\r\n\r\nif($love_filename==""){\r\n$love_filename="ooxx.me";\r\n}\r\nif($love_maker==""){\r\n$love_maker="life is like penis, it can be harder \n | http://ooxx.me bigCat";\r\n}\r\n//发送头类型为强制下载\r\nheader('Content-type: application/force-download');\r\n//定义二进制传输\r\nheader('Content-Transfer-Encoding: Binary');\r\n//定义内容长度\r\nheader('Content-length: ' . strlen($love_maker));\r\n//输入文件类型\r\nheader('Content-disposition: attachment; filename='.$love_filename);\r\n//输出内容\r\necho $love_maker;\r\n?>

\r\n\r\nAPI: http://code.sh/lab/makelove\r\npost filename 和 content 过来就行了

Host: (miao) | Word: Press | Code: HTML5