PHP 压缩文件夹的类!
<?php
/*
$Id: PHPZip.php
*/
class PHPZip {
var $datasec = array();
var $ctrl_dir = array();
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
var $old_offset = 0;
function Zip($dir, $zipfilename) {
if (@function_exists('gzcompress')) {
@set_time_limit("0");
$this->openFile($dir,$dir);
$out = $this -> filezip();
$fp = fopen($zipfilename, "w");
fwrite($fp, $out, strlen($out));
fclose($fp);
}
}
function openFile($path, $zipName) {
$temp_path = $path;
$temp_zip_path = $zipName;
$zipDir = $zipName;
if ($handle = @opendir($path)) {
while (false !== ($file = readdir($handle))) {
if($file !='.' and $file !='..'){
if(ereg('\.' , $file.@basename())) {
$fd = fopen($path.'/'.$file, "r");
$fileValue = @fread ($fd, 1024000);
fclose ($fd);
$this -> addFile($fileValue, $zipName . '/' . $file);
} else {
$this ->openFile($path.'/'.$file, $zipName . '/' . $file);
}
&nbs
相关文档:
1.在PHP中,当前脚本的名称(不包括路径和查询字符串)记录在预定义变量(1)中;而链接到当前页面的的前一页面URL记录在预定义变量(2)中
<?php
//本页地址,SCRIPT_NAME也可以
echo $_SERVER['PHP_SELF']."<br />";
//链接到当前页面的前一页面的 URL 地址:
echo $_SERVER ......
可用于php的计数器和表单的提交,防止反复刷新。
复制代码
<?php
session_start();
$allow_sep = "30000";
if (isset($_SESSION["post_sep"]))
{
if (time() - $_SESSION["post_sep"] < $allow_sep)
{
exit("请不要反复刷新");
}
else
{
$_SESSION["post_sep"] = time();
}
}
e ......
asp,asp.net,php,jsp下的301转向代码
使用.htaccess文件来进行301重定向。
如果空间不支持.htaccess文件,那么我们还可以通过php/asp代码来进行301重定向。
为了将搜索引擎的记录更新到现在的域名上面,做了几个301重定向的东东,给大家分享一下.
asp 301转向代码
在 index.asp 或 default.asp 的最顶部加入以 ......
说明:因为最近工作工作关系,需要开发一个在Linux下运行的Web Application,需要对现在比较流行的一些PHP框架做一个了解和评估,下面的这篇文章是笔者最近学习一个比较新的PHP Framework的一点经历和操作步骤,因为官方的手册写得比较晦涩(特别是中文的),曾经尝试遍读它那个手册再动手,读了一大半发现仍无法理解,于是 ......
include实现国际化
将index.php进行翻译:
Index内容
1. Index
2. About us
我们可以将index.php设置为一个翻译模版,所有出现字符的地方,都定义为变量,如1,2部分设置为翻译的变量$menu_index, $menu_aboutus.
......