;?
//php Tutorial Var_export Read-write instance Class
class user{
var $filepath;
function __ ()
{
& nbsp. $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, ' <?php return '. Var_export ($array, True). ';? > ');
fclose ($FP);
}
function Getvar_export ($value) {
$array = require ($this->filepath);
foreach ($array as $key => $v) {
if ($key = = $value) {
$selected = ' current option ';
} else {
$selected = ';
}
$html. = ' <option value= '. $key. '"' . $selected. ' > '. $v. ' </option> ';
}
return $html;
}
}
Working with instance methods
$g = new User ();
if (Intval ($_get[' iscreate '))
{
$g->cache ();
}
Else
{
$g->getvar_export (' vv ');
}
Original Www.111cn.net reprint of the site indicated the source
?>