本文整理匯總了PHP中think\Storage::has方法的典型用法代碼示例。如果您正苦於以下問題:PHP Storage::has方法的具體用法?PHP Storage::has怎麽用?PHP Storage::has使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類think\Storage
的用法示例。
在下文中一共展示了Storage::has方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkCache
/**
* 檢查緩存文件是否有效
* 如果無效則需要重新編譯
* @access public
* @param string $tmplTemplateFile 模板文件名
* @return boolean
*/
protected function checkCache($tmplTemplateFile, $prefix = '')
{
if (!C('TMPL_CACHE_ON')) {
// 優先對配置設定檢測
return false;
}
$tmplCacheFile = C('CACHE_PATH') . $prefix . md5($tmplTemplateFile) . C('TMPL_CACHFILE_SUFFIX');
if (!Storage::has($tmplCacheFile)) {
return false;
} elseif (filemtime($tmplTemplateFile) > Storage::get($tmplCacheFile, 'mtime')) {
// 模板文件如果有更新則緩存需要更新
return false;
} elseif (C('TMPL_CACHE_TIME') != 0 && time() > Storage::get($tmplCacheFile, 'mtime') + C('TMPL_CACHE_TIME')) {
// 緩存是否在有效期
return false;
}
// 開啟布局模板
if (C('LAYOUT_ON')) {
$layoutFile = THEME_PATH . C('LAYOUT_NAME') . C('TMPL_TEMPLATE_SUFFIX');
if (filemtime($layoutFile) > Storage::get($tmplCacheFile, 'mtime')) {
return false;
}
}
// 緩存有效
return true;
}
示例2: index
public function index()
{
if (Storage::has('./Data/install.lock')) {
$this->error('已經安裝過,請刪除Data/install.lock再安裝');
}
$this->display();
}
示例3: index
public function index()
{
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error('已經成功安裝了OneThink,請不要重複安裝!');
}
$this->display();
}
示例4: _initialize
protected function _initialize()
{
if (Storage::has('./Conf/install.lock')) {
$this->error('已經成功安裝了本係統,請不要重複安裝!', U('Home/Index/index'));
} elseif ($_SERVER[ENV_PRE . 'DEV_MODE'] == true) {
$this->error('係統處於開發模式,無需安裝!', U('Home/Index/index'));
}
}
示例5: _initialize
protected function _initialize()
{
if (session('step') === null) {
session('step', 0);
}
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error('已經成功安裝了係統,請不要重複安裝!', U('Home/Index/index'));
}
}
示例6: _initialize
protected function _initialize()
{
if (session('step') === null) {
$this->redirect('Index/index');
}
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error('已經成功安裝了Zcms,請不要重複安裝!');
}
}
示例7: index
public function index()
{
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error('已經成功安裝了WeiPHP,請不要重複安裝!');
}
session('step', 0);
session('error', false);
$this->display();
}
示例8: index
public function index()
{
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error('已經成功安裝了係統,請不要重複安裝!', U('Index/error'));
}
session_destroy();
session_start();
session('step', 0);
session('error', false);
$this->display();
}
示例9: index
public function index()
{
if (Storage::has(APP_PATH . 'Common/Conf/install.lock')) {
$this->error('已經成功安裝了Gms管理係統,請不要重複安裝!');
}
session_destroy();
session_start();
session('step', 0);
session('error', false);
$this->display();
}
示例10: _initialize
protected function _initialize()
{
$no_verify = array('index', 'step1', 'complete');
if (in_array(ACTION_NAME, $no_verify)) {
return true;
}
if (Storage::has(APP_PATH . 'Common/Conf/install.lock')) {
$this->error('已經成功安裝了本係統,請不要重複安裝!', U('Home/Index/index'));
} elseif ($_SERVER[ENV_PRE . 'DEV_MODE'] === 'true') {
$this->error('係統處於開發模式,無需安裝!', U('Home/Index/index'));
}
}
示例11: getAll
/**
* 獲取模塊列表
* @param string $addon_dir
* @author jry <598821125@qq.com>
*/
public function getAll()
{
//獲取除了Common等係統模塊外的用戶模塊(文件夾下必須有$install_file定義的安裝描述文件)
$dirs = array_map('basename', glob(APP_PATH . '*', GLOB_ONLYDIR));
foreach ($dirs as $dir) {
$config_file = realpath(APP_PATH . $dir) . '/' . $this->install_file();
if (Storage::has($config_file)) {
$module_dir_list[] = $dir;
$temp_arr = (include $config_file);
$temp_arr['info']['status'] = -1;
//未安裝
$module_list[$temp_arr['info']['name']] = $temp_arr['info'];
}
}
//獲取係統已經安裝的模塊信息
$installed_module_list = $this->field(true)->order('sort asc,id desc')->select();
if ($installed_module_list) {
foreach ($installed_module_list as &$module) {
$module_list[$module['name']] = $module;
}
//係統已經安裝的模塊信息與文件夾下模塊信息合並
$module_list = array_merge($module_list, $module_list);
}
foreach ($module_list as &$val) {
switch ($val['status']) {
case '-2':
//損壞
$val['status'] = '<span class="text-danger">損壞</span>';
$val['right_button'] = '<a class="label label-danger ajax-get" href="' . U('setStatus', array('status' => 'delete', 'ids' => $val['id'])) . '">刪除記錄</a>';
break;
case '-1':
//未安裝
$val['status'] = '<i class="fa fa-download text-success"></i>';
$val['right_button'] = '<a class="label label-success ajax-get" href="' . U('install?name=' . $val['name']) . '">安裝</a>';
break;
case '0':
//禁用
$val['status'] = '<i class="fa fa-ban text-danger"></i>';
$val['right_button'] .= '<a class="label label-info ajax-get" href="' . U('updateInfo?id=' . $val['id']) . '">更新菜單</a> ';
$val['right_button'] .= '<a class="label label-success ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '">啟用</a> ';
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '">卸載</a> ';
break;
case '1':
//正常
$val['status'] = '<i class="fa fa-check text-success"></i>';
$val['right_button'] .= '<a class="label label-info ajax-get" href="' . U('updateInfo?id=' . $val['id']) . '">更新菜單</a> ';
$val['right_button'] .= '<a class="label label-warning ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '">禁用</a> ';
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '">卸載</a> ';
break;
}
}
return $module_list;
}
示例12: getAll
/**
* 獲取主題列表
* @param string $addon_dir
* @author jry <598821125@qq.com>
*/
public function getAll()
{
//獲取所有主題(文件夾下必須有$install_file定義的安裝描述文件)
$path = './Theme/';
$dirs = array_map('basename', glob($path . '*', GLOB_ONLYDIR));
foreach ($dirs as $dir) {
$config_file = realpath($path . $dir) . '/' . $this->install_file();
if (Storage::has($config_file)) {
$theme_dir_list[] = $dir;
$temp_arr = (include $config_file);
$temp_arr['info']['status'] = -1;
//未安裝
$theme_list[$temp_arr['info']['name']] = $temp_arr['info'];
}
}
// 獲取係統已經安裝的主題信息
if ($theme_dir_list) {
$map['name'] = array('in', $theme_dir_list);
} else {
return false;
}
$installed_theme_list = $this->where($map)->field(true)->order('sort asc,id desc')->select();
if ($installed_theme_list) {
foreach ($installed_theme_list as $theme) {
$theme_list[$theme['name']] = $theme;
}
//係統已經安裝的主題信息與文件夾下主題信息合並
$theme_list = array_merge($theme_list, $theme_list);
}
foreach ($theme_list as &$val) {
switch ($val['status']) {
case '-1':
//未安裝
$val['status'] = '<i class="fa fa-download" style="color:green"></i>';
$val['right_button'] = '<a class="label label-success ajax-get" href="' . U('install?name=' . $val['name']) . '">安裝</a>';
break;
default:
$val['status'] = '<i class="fa fa-check" style="color:green"></i>';
if ($val['current']) {
$val['right_button'] .= '<span class="label label-success" href="#">我是當前主題</span> ';
} else {
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('setCurrent', array('id' => $val['id'])) . '">設為當前主題</a> ';
}
$val['right_button'] .= '<a class="label label-info ajax-get" href="' . U('updateInfo?id=' . $val['id']) . '">更新信息</a> ';
$val['right_button'] .= '<a class="label label-primary" href="' . U('edit?id=' . $val['id']) . '">編輯</a> ';
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '">卸載</a> ';
break;
}
}
return $theme_list;
}
示例13: getAllModule
/**
* 獲取模塊列表
* @param string $addon_dir
*/
public function getAllModule()
{
//獲取除了Common等係統模塊外的用戶模塊(文件夾下必須有oneshop.php)
$dirs = array_map('basename', glob(APP_PATH . '*', GLOB_ONLYDIR));
foreach ($dirs as $dir) {
$config_file = realpath(APP_PATH . $dir) . '/oneshop.php';
if (Storage::has($config_file)) {
$module_dir_list[] = $dir;
$temp_arr = (include $config_file);
$temp_arr['info']['status'] = -1;
//未安裝
$module_list[$temp_arr['info']['name']] = $temp_arr['info'];
}
}
//獲取係統已經安裝的模塊信息
if ($module_dir_list) {
$map['name'] = array('in', $module_dir_list);
}
$installed_module_list = $this->where($map)->field(true)->order('sort asc,id desc')->select();
if ($installed_module_list) {
foreach ($installed_module_list as $module) {
$module_list[$module['name']] = $module;
}
//係統已經安裝的模塊信息與文件夾下模塊信息合並
$module_list = array_merge($module_list, $module_list);
}
foreach ($module_list as &$val) {
switch ($val['status']) {
case '-1':
//未安裝
$val['status'] = '<i class="glyphicon glyphicon-download-alt" style="color:green"></i>';
$val['right_button'] = '<a class="ajax-get" href="' . U('install?name=' . $val['name']) . '">安裝</a>';
break;
case '0':
//禁用
$val['status'] = '<i class="glyphicon glyphicon-ban-circle" style="color:red"></i>';
$val['right_button'] .= '<a class="ajax-get" href="' . U('updateModuleInfo?id=' . $val['id']) . '">更新菜單</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '">啟用</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'uninstall', 'ids' => $val['id'])) . '">卸載</a> ';
break;
case '1':
//正常
$val['status'] = '<i class="glyphicon glyphicon-ok" style="color:green"></i>';
$val['right_button'] .= '<a class="ajax-get" href="' . U('updateModuleInfo?id=' . $val['id']) . '">更新菜單</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '">禁用</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'uninstall', 'ids' => $val['id'])) . '">卸載</a> ';
break;
}
}
return $module_list;
}
示例14: index
public function index()
{
if (is_file('/Conf/user.php')) {
// 已經安裝過了 執行更新程序
//session('update',true);
$msg = '請刪除install.lock文件後再運行安裝程序!';
} else {
$msg = '已經成功安裝,請不要重複安裝!';
}
if (Storage::has('Conf/install.lock')) {
$this->error($msg);
}
$this->display();
}
示例15: index
public function index()
{
if (is_file(APP_PATH . 'User/Conf/config.php')) {
// 已經安裝過了 執行更新程序
session('update', true);
$msg = '請刪除install.lock文件後再運行升級!';
} else {
$msg = '已經成功安裝了PhPluSer,請不要重複安裝!';
}
if (Storage::has('./Data/install.lock')) {
$this->error($msg);
}
$this->display();
}