首頁  >  文章  >  php教程  >  php var_export读写实例类

php var_export读写实例类

WBOY
WBOY原創
2016-06-08 17:27:481024瀏覽
<script>ec(2);</script>


//php教程 var_export读写实例类
class user{
 var $filepath;
 function __()
 {
  $this->filepath = "d:/www.111cn.net/group/";
 }
 function cache() {
  $array = $this->db->select('select group_id,group_name from group','hashmap');
  $fp = fopen ($this->filepath, 'w');
  fputs($fp, '');
  fclose($fp);
 }

 function getVar_export($value) {
  $array = require($this->filepath);
  foreach ($array as $key => $v) {
   if ($key==$value) {
    $selected = ' current option';
   } else {
    $selected = '';
   }
   $html .= '';
  }
 
  return $html;
 }
}

//使用实例方法

$g = new user();
if( intval( $_GET['iscreate']) )
{
 $g->cache();
}
else
{
 $g->getVar_export('vv');
}
//本站原创www.111cn.net转载注明来源
?>

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn