Home php教程 php手册 跪求 PHP文件读写流的问题

跪求 PHP文件读写流的问题

Jun 06, 2016 pm 07:46 PM
php one time several document method Read and write question

想请问一下这几个方法分别是做什么用的?主要是最后那个方法不懂?最好是标记注释。在下在这里谢过了。。虽然分数不多,但是没有办法了。只有这么多了.感激不尽.... ?php class Account_Del { ///Create File function Create_file($sFile) { if (!file_exis

想请问一下这几个方法分别是做什么用的?主要是最后那个方法不懂?最好是标记注释。在下在这里谢过了。。虽然分数不多,但是没有办法了。只有这么多了.感激不尽....

class Account_Del
{
 ///Create File
 function Create_file($sFile)
 {
     if (!file_exists($sFile))
   { 
      $fp= fopen($sFile,"w+");
    system('chown apache '.$sFile);
      fclose($fp);
     }
 }

 ///Delete File
 function Delete_file($sFile) 
 {
  if(file_exists($sFile)) 
   unlink($sFile);
 } 
 
 function DelAcc()
 {  
  if(!file_exists("./ac/aclist.ini")) 
   exit;
  
  $fp =@fopen("./ac/aclist.ini","r");
  $temp="";
  while(!feof($fp))
  {
   $temp=$temp.fgets($fp);
  }
  
  $flag=false;
  
  $temp=str_replace("\r\n","",$temp);
  $Accounts=explode(",",$temp);
  
  $time  =  time();  
  $nowdate = date('Y-m-d',  $time);
  $Times1=explode("-",$nowdate);
  
  for($i=0;$i  {   
   if($Accounts[$i]!="")
   {
    $first = substr($Accounts[$i],0,1);
    if (eregi("^[A-Za-z]{1}[A-Za-z]{0,2}$",$first))
    {
     $Accounts1=explode("&",$Accounts[$i]);
     if(strlen($Accounts1[1])>=8) //日期格式2008-04-08/2008-4-8/2008-04-8/2008-4-08 最少8位最长10位
     {
      $Times2=explode("-",$Accounts1[1]);    
      $n=(mktime(0,0,0,$Times1[1],$Times1[2],$Times1[0])-mktime(0,0,0,$Times2[1],$Times2[2],$Times2[0]))/(60*60*24);     
      if($n>=90)
      {    
       system('/usr/sbin/userdel -r '.$Accounts1[0], $return);
       if($return==0)
       {
        $flag=true;
        $Accounts[$i]="";
       }           
      }
     }//strlen
    }//eregi
   }
  }
  
  if($flag)
  {    
   $this->Delete_file("./ac/aclist.ini");
   $this->Create_file("./ac/aclist.ini");
   
   $temp="";
   $fp = @fopen("./ac/aclist.ini","a");
   for($i=0;$i   {
    if($Accounts[$i]!="")
    {
     if(eregi("^[a-z]{1}[a-z]{0,2}$",substr($Accounts[$i],0,1)))
      $temp=$temp.$Accounts[$i].','; 
    } 
   }
   @fwrite($fp,$temp);   
   @fclose($fp);  
  } 
  
  exit;  
 }

}//end class

$AccDel =new Account_Del;
$AccDel->DelAcc();
?>

=======下面是aclist.ini文件的信息=分别是 用户名 创建时间 终止时间====

root&&,bin&&,daemon&&,adm&&,lp&&,sync&&,shutdown&&,halt&&,mail&&,news&&,uucp&&,operator&&,games&&,gopher&&,ftp&&,nobody&&,ntp&&,rpc&&,vcsa&&,nscd&&,sshd&&,rpm&&,mailnull&&,smmsp&&,rpcuser&&,nfsnobody&&,pcap&&,xfs&&,wnn&&,named&&,gdm&&,desktop&&,postgres&&,apache&&,postfix&&,squid&&,webalizer&&,oishare&&,jasonma&&,sente&&,mysql&&,oi&&,gaga&&,fisherprice&&,fisherprice327&&,hasbro&&,mattel&&,mattel_la&&,softshare&&,sonix&&,MGA&&,temp&&,VisualStudio&&,stock&&,sat&&,leapfrog&&,cdttest&&,winenterprise&&,PIL&&,vtech&&,smtpu&&,solforcarmen&&,Mattel&&,EI&&,Tomy&&,SWT&&,mike&&,mattel_hk&&,Takara&&,konami&&,cranium&&,wizardtronics&&,reddot&&,hasbro_fran&&,sonix-cdt&&,fp_kd&&,mgae&&,temp_cdt&&,usr&&,kdi&&,kidsii&&,TomyUK&&,toytec&&,DES&&,mt&&,warehouse&&,acct_hk&&,idt&&,huaqi&&,omnivision&&,mac&&,it&&,micomtech&&,backpacktoys&&,IDT&&,pacific_hk&&,mttest&&,mga&&,onyxx&&,test&&,test1&&,mattel_tmp&&,wiltec&&,sunvigor&&,spinmaster&&,mis0810&2009-08-26&2035-12-31,mis0811&2009-08-11&2009-08-25,philips&2009-08-11&2009-08-25,vt_temp&2009-08-12&2009-08-26,sonosys&2009-08-13&2009-08-27,R3916&2009-08-13&2009-08-27,www888&2009-08-14&2009-08-28,simtec&2009-08-17&2009-08-31,puppy&2009-08-18&2009-09-01&idtidt&2009-08-20&2009-09-03,R9100&2009-08-20&2009-09-03,vt110605&2009-08-21&2009-09-04,mhg&2009-08-26&2009-09-09,Voice&2009-08-27&2009-09-10,midi&2009-08-27&2009-09-10,SNC712&2009-09-01&2009-09-15,OI2009&2009-09-01&2009-09-15,mis0901&2009-09-01&2009-09-15,davidw&2009-09-03&2009-09-17,Herald&2009-09-04&2009-09-18,Escope&2009-09-08&2009-09-22,wilsonli&2009-09-09&2009-09-23,Book&2009-09-09&2009-09-24,caddie&2009-09-10&2009-09-24,V117000&2009-09-10&2009-09-24,sound&2009-09-11&2009-09-25,ericfung&2009-09-14&2009-09-28,vtech03&2009-09-15&2009-09-29,talent&2009-09-16&2009-09-30,idthk&2009-09-16&2009-09-30,vt110604&2009-09-16&2009-09-30,ching1&2009-09-17&2009-10-01,T4272&2009-09-17&2009-10-01,WUTZSD03&2009-09-18&2009-10-02,SNC712c&2009-09-18&2009-10-02,dm27132&2009-09-21&2009-10-05,benjalin&2009-09-22&2009-10-06,mis0923&2009-09-23&2009-10-07,W200909&2009-09-23&2009-10-07,t2rd0925&2009-09-25&2009-10-09,vthf0925&2009-09-25&2009-10-09,mis0928&2009-09-28&2009-10-12,voice09&2009-09-28&2009-10-12,caddie1&2009-09-28&2009-10-12,vt110622&2009-09-29&2009-10-13,RSV&2009-09-30&2009-10-14,vt110623&2009-09-30&2009-10-14,WUTZ_V01&2009-09-30&2009-10-14,LC99596&2009-10-07&2009-10-21,TMC&2009-10-07&2009-10-21,FB02&2009-10-07&2009-10-21,ids712&2009-10-08&2009-10-22,dm110622&2009-10-13&2009-10-27,rc2ef&2009-10-14&2009-10-28,mis0914&2009-10-14&2009-10-28,escope&2009-10-15&2009-10-29,dm110623&2009-10-15&2009-10-29,snx1015&2009-10-15&2009-10-29,tt1016&2009-10-16&2009-10-30,balloon&2009-10-16&2009-10-30,keita&2009-10-16&2009-10-30,t1403712&2009-10-16&2009-10-30,honeybee&2009-10-17&2009-10-31,caddie2&2009-10-22&2009-11-05,Chomp&2009-10-27&2009-11-10,OTP&2009-10-27&2009-11-10,spin1028&2009-10-28&2009-11-11,mis1028&2009-10-28&2009-11-11,CY800&2009-10-29&2009-11-12,rav&2009-10-29&2009-11-12,vt101923&2009-10-29&2009-11-12,radica&2009-10-30&2009-11-13,nerul26f&2009-11-04&2009-11-18,caddie3&2009-11-04&2009-11-18,rc2eric&2009-11-05&2009-11-19,

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles