易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

配置Apache的访问目录(for PHP)

       在默认情况下,php的项目需要建在Apache Group\Apache\htdocs目录下才可以正常访问。当我们需要自己建立一个不在Apache Group\Apache\htdocs目录下的工作区间时,就需要改变Apache的访问指定路径。安装好Apache 后,在Apache Group\Apache\conf 下有一个文件httpd.conf,它里面包含着 ......

PHP进度条效果

用PHP实现进度条效果。
<?php
set_time_limit(0);
echo '<h2>正在安装,请稍后...</h2>',
'<div style="border:1px solid #000;width:500px;"><div id="progress_bar">loading...</div></div>';
for($i=1;$i<=100;$i++){
$width = '500';
......

php mysql 配置php.ini

文件php.ini放入windows下,将下面内容拷贝到记事本命名为php.ini放入c:/windows下,重启Apache server:
[PHP]
;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHP installations.
; By default, PHP installs itself with a configuration suitable for
; development purposes ......

PHP做后台程序的一些问题

PHP的优点是简单实用。用它来写一些脚本,或者是webservice、数据库类的一些访问,确实是很简单方便。
但它有一个很大的问题,就是内存的回收问题。根据使用的经验觉得是几乎是没有回收。比如解析一个1百兆的XML文件,内存使用能到1G多,而且还不释放。
所以用php写后台程序,一定不要做成死循环的,至少是过一段时间退出 ......

php session配置

Session]
; 除非使用session_register()或$_SESSION注册了一个变量。
; 否则不管是否使用了session_start(),都不会自动添加任何session记录。
; 包括resource变量或有循环引用的对象包含指向自身的引用的对象,不能保存在会话中。
; register_globals指令会影响到会话变量的存储和恢复。
session ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号