flie php

来源:互联网 发布:淘宝卖家一年的收入 编辑:程序博客网 时间:2024/06/18 15:55

<?

  class files{
      var $name;

  function files($name=null){
     if($name)
       $this->name=$name;
  }
  function setName($name){
     $this->name=$name;
  }
  function openFile($name,$type='r'){
     if(empty($name)||!file_exists($name)){
        return null;
     }
     return fopen($name,$type);
  }
  function getRT($name,$sp){
     $rt=array();
     $fn=$this->openFile($name,'r');
     while(!feof($fn)){
          $row=fgets($fn);
       $rows=explode($sp,$row);
       array_push($rt,$rows);
     }
      return $rt;
  }
}

原创粉丝点击