麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
<?php 生成静态页面的PHP程序 ?>
悬赏分:20 - 2007年05月29日

[php]
<?php
// +-----------------------------------------------------------------------
// | iZz :: File
// +-----------------------------------------------------------------------
// | Copyright (c) 2000-2002 iZz Studio
// +-----------------------------------------------------------------------
// | This source file is created by iZz Studio. And this file is not
// | public and not a open source file. If you get this file, and not
// | , please contact us by emailing to justdn@justdn.com.
// |
// |
// |
// |
// |
// +-----------------------------------------------------------------------
// | Author(s):
// |
// |
// +-----------------------------------------------------------------------
//
// $Id: iZzFile.php,v 1.1 2002/10/31 11:16:21 Beijing Time Zone $

//-------------------------------------------------------------------------
//
//使用方法:
//只读ifile = new iFile('test.txt','r');
//读写ifile = new iFile('test.txt','w');
//快读ifile = new iFile('test.txt','dr');
//快写ifile = new iFile('test.txt','w','测试一下咯');
//读取文件内容ifile->getFileData();
//显示读取/快读数据:echo $ifile->Data;
//写入文件内容ifile->WriteFile('测试一下咯',3);
//关闭文件句柄ifile->ColseFile();
//
//注意:写入/快写后自动关闭文件句柄.
//-------------------------------------------------------------------------
class iFile {

var $Fp;
var $Pipe; //(fopen,popen)(f,p)
var $File;
var $OpenMode; //(r,r+,w,w+,a,a+,b)
var $Data;

function iFile($File,$Mode = 'r',$Data4Write='',$Pipe = 'f'){
$this -> File = $File;
$this -> Pipe = $Pipe;
if($Mode == 'dr'){
$this -> openMode = 'r';
$this -> OpenFile();
$this -> getFileData();
}else{
$this -> openMode = $Mode;
$this -> OpenFile();
}
if($this->OpenMode=='w'&&$Data4Write!=''){
$this -> WriteFile($Data4Write,$Mode = 3);
}
}

function OpenFile(){
if ($this -> openMode == 'r'||$this -> openMode == 'r+'){
if($this->CheckFile()){
if ($this -> Pipe == 'f') {
$this->Fp = fopen($this -> File, $this -> OpenMode);
} elseif ($Pipe == 'p') {
$this->Fp = popen($this -> File, $this -> OpenMode);
}else{
Die("Check The OpenFile Pipe,It can be 'f' or 'p'./请检查文件打开参数3,f:fopen(),poen().");
}
} else {
Die("Access Error: Check $File is exist./文件访问错误,请检查文件是否存在!");
}
} else {
if ($this -> Pipe == 'f') {
$this->Fp = fopen($this -> File, $this -> OpenMode);
} elseif ($Pipe == 'p') {
$this->Fp = popen($this -> File, $this -> OpenMode);
} else {
Die("Check The OpenFile Pipe,It can be 'f' or 'p'./请检查文件打开参数3,f:fopen(),poen().");
}
}
}

function CloseFile(){
if ($this->Pipe == 'f'){
@fclose($this->Fp);
} else {
@pclose($this->Fp);
}
}

function getFileData(){
@flock($this->Fp, 1);
$Content = fread($this->Fp, filesize($this->File));
$this->Data = $Content;
}

function CheckFile(){
if (file_exists($this -> File)) { return true; } else { return false; }
}

function WriteFile($Data4Write,$Mode = 3){
@flock($this->Fp,$Mode);
fwrite($this->Fp,$Data4Write);
$this->CloseFile();
return true;
}

}
?>
[/php]

提问者:intphp   05-29 14:02
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
8 + 39 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM