<?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 [email protected].
// |
// |
// |
// |
// |
// +-----------------------------------------------------------------------
// | 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("d");
}
} else {
Die("d");
}
} else {
if ($this -> Pipe == 'f') {
$this->Fp = fopen($this -> File, $this -> OpenMode);
} elseif ($Pipe == 'p') {
$this->Fp = popen($this -> File, $this -> OpenMode);
} else {
Die("h");
}
}
} 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
$file = time().".txt";
$ifile = new iFile($file,'w','测试一下咯');
?>
// +-----------------------------------------------------------------------
// | 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 [email protected].
// |
// |
// |
// |
// |
// +-----------------------------------------------------------------------
// | 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("d");
}
} else {
Die("d");
}
} else {
if ($this -> Pipe == 'f') {
$this->Fp = fopen($this -> File, $this -> OpenMode);
} elseif ($Pipe == 'p') {
$this->Fp = popen($this -> File, $this -> OpenMode);
} else {
Die("h");
}
}
} 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
$file = time().".txt";
$ifile = new iFile($file,'w','测试一下咯');
?>
你自己摆出来的代码只不过是一段文件写入程序的打包而已。这就叫自动页面生成系统???
自动生成HTML页面系统要做到哪些??
1、可以自定义HTML元变量。
2、可以自定义元变量相对应的函数和SQL语句。
3、能适应于一般的网站页面自动生成,而不需要专门针对的去做。你上面的那叫什么???
就getout,下回我们对他的问题不参与就是了,
看你还不如俺这个农民...
给我打工我都不要....