![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
相关问题
CODE: <?php /** @title:PHP持久对象演示(app demo) @version:1.1-dev @author:axgle <axgle@126.com> */ $user=new app('user'); echo $user->next(); echo '<pre>'; print_r($user); class app { var $id; var $file; function app($file='default') { $this->id=0; $this->file="app_".$file; $last=unserialize(@file_get_contents($this->file)); if($last instanceof $this) { foreach($last as $key=>$val) { $this->$key=$val; } } } function prev() { return --$this->id; } function next() { return ++$this->id; } function __destruct() { file_put_contents($this->file,serialize($this)); } } ?> |
提问者:axgle 08-18 11:11
答复

