function F($name, $value='', $path = DATA_PATH) {
$filename = $path . $name . '.php';
switch ($value){
case '' : goto read;
case NULL : return unlink($filename);
default :
$dir = dirname($filename); is_dir($dir) or mkdir($dir,0755,true);
return file_put_contents($filename, json_encode($value));
}
read:
if (is_file($filename)) {
return json_decode(file_get_contents($filename), true);
} else {
return false;
}
}
PHP 5.3+有效