⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.class.php

📁 PHP+IIS+MySQL开发物流管理系统
💻 PHP
字号:
<?php#------------------------------------------------------------------------------#[谢您使用情感家园企业站程序:qgweb]#[本程序由情感开发完成,当前版本:5.0]#[本程序基于LGPL授权发布]#[官方网站:www.phpok.com   www.qinggan.net]#[客服邮箱:qinggan@188.com]#[文件:file.php]#------------------------------------------------------------------------------class FILES{	var $readCount = 0;	function FILES()	{		//	}	function qgRead($file="")	{		if($file)		{			$this->readCount++;			$check = strtolower($file);			if(strpos($check,"http://") === false)			{				if(!file_exists($file))				{					return false;				}			}			$content = file_get_contents($file);			$content = str_replace("<?php die('forbidden'); ?>\n","",$content);			return $content;		}		else		{			return false;		}	}	#[存储数据]	function qgWrite($content,$file,$var="",$type="wb")	{		$this->qgMake($file,"file");		if(is_array($content) && $var)		{			$content = $this->__array($content,$var);			$content = "<?php\n".$content."\n?".">";			$content = stripslashes($content);		}		else		{			$content = stripslashes($content);			$content = "<?php die('forbidden'); ?>\n".$content;		}		$this->_write($content,$file,$type);		return true;	}	#[存储php等源码文件]	function qgHtml($content,$file)	{		$this->qgMake($file,"file");		$content = stripslashes($content);		$this->_write($content,$file,"wb");		return true;	}	#[删除数据操作]	#[这一步操作一定要小心,在程序中最好严格一些,不然有可能将整个目录删掉!]	function qgDelete($file,$type="file")	{		$array = $this->_dir_list($file);		if(is_array($array))		{			foreach($array as $key=>$value)			{				if(file_exists($value))				{					@unlink($value);				}			}		}		else		{			if(file_exists($array) && is_file($array))			{				@unlink($array);			}		}		//如果要删除目录,同时设置		if($type == "folder")		{			rmdir($file);		}		return true;	}	#[创建文件或目录]	function qgMake($file,$type="dir")	{		$array = explode("/",$file);		$count = count($array);		$msg = "";		if($type == "dir")		{			for($i=0;$i<$count;$i++)			{				$msg .= $array[$i];				if(!file_exists($msg) && ($array[$i]))				{					mkdir($msg,0777);				}				$msg .= "/";			}		}		else		{			for($i=0;$i<($count-1);$i++)			{				$msg .= $array[$i];				if(!file_exists($msg) && ($array[$i]))				{					mkdir($msg,0777);				}				$msg .= "/";			}			@touch($file);//创建文件		}		return true;	}	#[复制操作]	function qgCopy($old,$new,$recover=true)	{		if(substr($new,-1) == "/")		{			$this->qgMake($new,"dir");		}		else		{			$this->qgMake($new,"file");		}		if(is_file($new))		{			if($recover)			{				@unlink($new);			}			else			{				return false;			}		}		else		{			$new = $new.basename($old);		}		@copy($old,$new);		return true;	}	#[文件移动操作]	function qgMove($old,$new,$recover=true)	{		if(substr($new,-1) == "/")		{			$this->qgMake($new,"dir");		}		else		{			$this->qgMake($new,"file");		}		if(is_file($new))		{			if($recover)			{				@unlink($new);			}			else			{				return false;			}		}		else		{			$new = $new.basename($old);		}		@rename($old,$new);		return true;	}	#[获取文件夹列表]	function qgDir($folder)	{		$this->readCount++;		return $this->_dir_list($folder);	}	function _dir_list($file,$type="folder")	{		if(substr($file,-1) == "/") $file = substr($file,0,-1);		if($type == "file")		{			return $file;		}		elseif(is_dir($file))		{			$handle = opendir($file);			$array = array();			while(false !== ($myfile = readdir($handle)))			{				if($myfile != "." && $myfile != "..") $array[] = $file."/".$myfile;			}			closedir($handle);			return $array;		}		else		{			return $file;		}	}	#[对多层次数组进行排序,同时删除重复数据!]	function __array($array,$var,$content="")	{		foreach($array as $key=>$value)		{			if(is_array($value))			{				$content .= $this->__array($value,$var."[\"".$key."\"]",$content);			}			else			{				$content .= "\$".$var."[\"".$key."\"] = \"".$value."\";\n";			}		}		$content_array = explode("\n",$content);		$content_array = array_unique($content_array);		$content = implode("\n",$content_array);		unset($content_array);		return $content;	}	#[打开文件]	function _open($file,$type="wb")	{		$handle = fopen($file,$type);		$this->readCount++;		return $handle;	}	#[写入信息]	function _write($content,$file,$type="wb")	{		$handle = $this->_open($file,$type);		fwrite($handle,$content);		unset($content);		$this->close($handle);		return true;	}	function close($handle)	{		return @fclose($handle);	}}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -