易截截图软件、单文件、免安装、纯绿色、仅160KB

php下载文件相关资料

当下载文件需要与服务端交互时,就需要用脚本来实现,而不是单纯地链接到文件的地址
下载mp3文件的例子
<?php
$file_path = './data/upload/song/sample.mp3';
$file_name = 'sample.mp3';
$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:audio/mpeg MP3");
header ( "Content-Length: " . $file_size);
header ( "Content-Disposition: attachment; filename=".$file_name);
echo(file_get_contents($file_path));
exit;
?>
以下列表来自http://hi.baidu.com/zbzb /blog/item/643cd60021d25d11738b6530.html
Content-type 的说明 'application/andrew-inset',
'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
'doc' => 'application/msword',
'bin' => 'application/octet-stream',
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => 'application/octet-stream',
'class' => 'application/octet-stream',
'so' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => 'application/pdf',
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => 'application/vnd.ms-excel',
'ppt' => 'application/vnd.ms-powerpoint',
'wbxml' => 'application/vnd.wap.wbxml',
'wmlc' => 'application/vnd.wap.wmlc',
'wmlsc' => 'application/vnd.wap.wmlscriptc',
'bcpio' => 'application/x-bcpio',
'vcd' => 'application/x-cdlink',
'pgn' => 'application/x-chess-pgn',
'cpio' => 'application/x-cpio',
'csh' => 'application/x-csh',
'dcr' => 'application/x-director',
'di


相关文档:

PHP 制作通讯录(六)

昨天我们实现了一个简单的搜索功能,今天我想了一下,其实还有可以改进的地址,如直接用Index.php代替Search.php。
修改Index.php文件,修改一下搜索表单
<!---搜索框--->
<!--这里的所有值前面加前缀“S_”以区分-->
<form id="form1" name="form1" method="get" action="Index.php">
&n ......

PHP 判断FORM来的数据是否为整数

is_int函数对于FORM过来的数据是没有办法判断是否是整数的,因为FORM过来的是字符串。用is_numeric可以判断是否为数字类型,稍动 下手脚就可以判断是不是整数了
if(!is_numeric($jp_total)||strpos($jp_total,".")!==false){
echo "不是整数";
}else{
echo "是整数";
} ......

PHP后台程序对LINUX信号的处理

PHP在运行的时候,直接kill掉,有肯能造成数据的丢失。幸好php模块,有针对signal的处理。
处理方式,首先检查有没有安装 PCNTL 模块
然后可以在一个包含文件中,添加以下代码
global $exitFlag;
$exitFlag = false;
// 增加linux信号量处理
if (DIRECTORY_SEPARATOR != '\\') {
    pcntl_signal(SI ......

php获取原图片

<?php
/*
获取远程图片函数
*/
function GrabImage($url,$filename=""){
//若url为空返回false,无地址
if($url=="") return false;
//若$filename为空
if($filename=="") {
$ext=strrchr($url,"."); //获取"."加后缀
if($ext!=&qu ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号