本文整理匯總了PHP中sp_clear_cache函數的典型用法代碼示例。如果您正苦於以下問題:PHP sp_clear_cache函數的具體用法?PHP sp_clear_cache怎麽用?PHP sp_clear_cache使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了sp_clear_cache函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: clean
public function clean()
{
if (sp_clear_cache()) {
$this->success('緩存已清除');
} else {
$this->error('緩存清楚失敗!');
}
}
示例2: index_post
public function index_post()
{
$_POST = array_map('trim', I('post.'));
if (in_array('', $_POST)) {
$this->error("不能留空!");
}
$configs['SP_MAIL_ADDRESS'] = $_POST['address'];
$configs['SP_MAIL_SENDER'] = $_POST['sender'];
$configs['SP_MAIL_SMTP'] = $_POST['smtp'];
$configs['SP_MAIL_LOGINNAME'] = $_POST['loginname'];
$configs['SP_MAIL_PASSWORD'] = $_POST['password'];
$rst = sp_set_dynamic_config($configs);
sp_clear_cache();
if ($rst) {
$this->success("保存成功!");
} else {
$this->error("保存失敗!");
}
}
示例3: index
public function index()
{
sp_clear_cache();
$this->success('緩存更新成功', U('Index/index'));
}
示例4: sp_set_dynamic_config
function sp_set_dynamic_config($data)
{
if (sp_is_sae()) {
$kv = new SaeKV();
$ret = $kv->init();
$configs = $kv->get("THINKCMF_DYNAMIC_CONFIG");
$configs = empty($configs) ? array() : unserialize($configs);
$configs = array_merge($configs, $data);
$result = $kv->set('THINKCMF_DYNAMIC_CONFIG', serialize($configs));
} elseif (defined('IS_BAE') && IS_BAE) {
$bae_mc = new BaeMemcache();
$configs = $bae_mc->get("THINKCMF_DYNAMIC_CONFIG");
$configs = empty($configs) ? array() : unserialize($configs);
$configs = array_merge($configs, $data);
$result = $bae_mc->set("THINKCMF_DYNAMIC_CONFIG", serialize($configs), MEMCACHE_COMPRESSED, 0);
} else {
$config_file = "./data/conf/config.php";
if (file_exists($config_file)) {
$configs = (include $config_file);
} else {
$configs = array();
}
$configs = array_merge($configs, $data);
$result = file_put_contents($config_file, "<?php\treturn " . var_export($configs, true) . ";?>");
}
sp_clear_cache();
return $result;
}
示例5: clearcache
function clearcache()
{
sp_clear_cache();
$this->display();
}