extend/alipay/pay/lotusphp_runtime/StoreFile.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
class LtStoreFile implements LtStore
{
public $storeDir;
public $prefix = 'LtStore';
public $useSerialize = false;
static public $defaultStoreDir = "/tmp/LtStoreFile/";
public function init()
{
/**
* 目录不存在和是否可写在调用add是测试
* @todo detect dir is exists and writable
*/
if (null == $this->storeDir)
{
$this->storeDir = self::$defaultStoreDir;
}
$this->storeDir = str_replace('\\', '/', $this->storeDir);
$this->storeDir = rtrim($this->storeDir, '\\/') . '/';
}
/**
* 当key存在时:
* 如果没有过期, 不更新值, 返回 false
* 如果已经过期, 更新值, 返回 true
*
* @return bool
*/
public function add($key, $value)
{
$file = $this->getFilePath($key);
$cachePath = pathinfo($file, PATHINFO_DIRNAME);
if (!is_dir($cachePath))
{
if (!@mkdir($cachePath, 0777, true))
{
trigger_error("Can not create $cachePath");
}
}
if (is_file($file))
{
return false;
}
if ($this->useSerialize)
{
$value = serialize($value);
}
$length = file_put_contents($file, '<?php exit;?>' . $value);
return $length > 0 ? true : false;
}
/**
* 删除不存在的key返回false
*
* @return bool
*/
public function del($key)
{
$file = $this->getFilePath($key);
if (!is_file($file))
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。