21,893
社区成员




class TokenStorage{
public function performAction($action,$data){
switch ($action){
case 'create':
$this->createToken($data);
break;
case 'delete':
$this->clearToken($data);
break;
default:
throw new Exception('unknown action');
}
}
public function createToken($seed){
$token = md5($seed);
file_put_contents('D:\\phpStudy\\PHPTutorial\\WWW\\day6\\'.$token,'....data');
}
public function clearToken($token){
$file=preg_replace("/[^a-z.-_]","",$token);
unlink('D:\\phpStudy\\PHPTutorial\\WWW\day6\\'.$file);
}
}
$storage= new TokenStorage();
$storage->performAction($_GET['action'],$_GET['data']);
//action = delete&data