当前位置: 首页>>代码示例>>PHP>>正文


PHP model::cache方法代码示例

本文整理汇总了PHP中model::cache方法的典型用法代码示例。如果您正苦于以下问题:PHP model::cache方法的具体用法?PHP model::cache怎么用?PHP model::cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model的用法示例。


在下文中一共展示了model::cache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doSave

 function doSave()
 {
     $id = (int) $_POST['id'];
     $name = dhtmlspecialchars($_POST['name']);
     $table = dhtmlspecialchars($_POST['table']);
     $description = dhtmlspecialchars($_POST['desc']);
     $position2 = $_POST['pos'];
     $position = $_POST['position'];
     $binding = isset($_POST['binding']) ? 1 : 0;
     empty($name) && javascript::alert('模块名称不能为空!');
     empty($table) && $binding && javascript::alert('模块名不能为空!');
     if (!$binding && empty($id)) {
         if (empty($table)) {
             include iPATH . 'include/cn.class.php';
             $table = CN::pinyin($name);
         }
         $table = $table . '_content';
     }
     if ($id) {
         iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__model` where `table` = '{$table}' and `id`!='{$id}'") && javascript::alert('该模块已经存在!请检查是否重复');
         iCMS_DB::query("UPDATE `#iCMS@__model` SET `name` = '{$name}', `table` = '{$table}', `binding` = '{$binding}', `description` = '{$description}', `position` = '{$position}', `position2` = '{$position2}' WHERE `id` = '{$id}';");
     } else {
         iCMS_DB::query("INSERT INTO `#iCMS@__model`(`name`, `table`, `binding`, `description`, `position`,`position2`, `addtime`)VALUES ('{$name}', '{$table}', '{$binding}', '{$description}', '{$position}','{$position2}', '" . time() . "');");
         $id = iCMS_DB::$insert_id;
     }
     model::cache();
     $moreaction = array(array("text" => "下一步添加字段", "url" => __SELF__ . "?mo=models&do=addfield&id=<?php echo {$id};?>"), array("text" => "返回模块列表", "url" => __SELF__ . "?mo=models&do=manage"));
     javascript::dialog('模块添加完成!<br />10秒后返回模块列表', "url:" . __SELF__ . "?mo=models&do=manage", $moreaction, 10);
 }
开发者ID:idreamsoft,项目名称:iCMS5.0,代码行数:29,代码来源:models.mo.php

示例2: doUpdate

 function doUpdate()
 {
     include_once iPATH . 'include/forum.class.php';
     if ($_POST['forum']) {
         $forum = new forum();
         $forum->cache();
     }
     if ($_POST['adm']) {
         include_once iPATH . 'admin/advertise.mo.php';
         $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__advertise`", OBJECT);
         $_count = count($rs);
         for ($i = 0; $i < $_count; $i++) {
             adm($rs[$i]);
         }
     }
     $_POST['tpl'] && $this->iCMS->clear_compiled_tpl();
     $_POST['iCMS_list'] && FS::rmdir(iPATH . 'cache/list');
     $_POST['iCMS_forum'] && FS::rmdir(iPATH . 'cache/forum');
     $_POST['iCMS_tag'] && FS::rmdir(iPATH . 'cache/tags');
     if ($_POST['iCMS_ALL']) {
         FS::rmdir(iPATH . 'cache/list');
         FS::rmdir(iPATH . 'cache/forum');
         FS::rmdir(iPATH . 'cache/tags');
     }
     $_POST['keywords'] && keywords_cache();
     $_POST['tags'] && tags_cache();
     if ($_POST['model']) {
         include iPATH . 'include/model.class.php';
         model::cache();
     }
     $_POST['field'] && field_cache();
     $_POST['config'] && CreateConfigFile();
     if ($_POST['Re-Article-Count']) {
         $rs = iCMS_DB::getArray("SELECT fid FROM `#iCMS@__forum`");
         $_count = count($rs);
         for ($i = 0; $i < $_count; $i++) {
             $c = iCMS_DB::getValue("SELECT count(*) FROM #iCMS@__article where `fid`='" . $rs[$i]['fid'] . "' LIMIT 1 ");
             iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` ='{$c}' WHERE `fid` ='" . $rs[$i]['fid'] . "' LIMIT 1 ");
         }
     }
     if ($_POST['Re-Tag-Count']) {
         include_once iPATH . 'include/forum.class.php';
         $rs = iCMS_DB::getArray("SELECT id FROM `#iCMS@__tags`");
         $_count = count($rs);
         for ($i = 0; $i < $_count; $i++) {
             $_count = iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__taglist` WHERE `tid`='" . $rs[$i]['id'] . "'");
             iCMS_DB::query("UPDATE `#iCMS@__tags` SET `count` = '{$_count}'  WHERE `id` ='" . $rs[$i]['id'] . "'");
             tags_cache($rs[$i]['id']);
         }
     }
     javascript::dialog("执行完毕!", 'url:1');
 }
开发者ID:idreamsoft,项目名称:iCMS5.0,代码行数:52,代码来源:cache.mo.php

示例3: doSave

 function doSave()
 {
     $id = (int) $_POST['id'];
     $name = dhtmlspecialchars($_POST['name']);
     $table = dhtmlspecialchars($_POST['table']);
     $description = dhtmlspecialchars($_POST['desc']);
     $show = (int) $_POST['show'];
     $position = $_POST['position'];
     $position2 = $_POST['pos'];
     $form = dhtmlspecialchars($_POST['form']);
     $binding = isset($_POST['binding']) ? 1 : 0;
     empty($name) && javascript::alert('模块名称不能为空!');
     empty($table) && $binding && javascript::alert('模块名不能为空!');
     if (!$binding && empty($id)) {
         if (empty($table)) {
             include iPATH . 'include/cn.class.php';
             $table = CN::pinyin($name);
         }
     }
     !preg_match("/[a-zA-Z]/", $table[0]) && javascript::alert('模型表名只能以英文字母开头');
     !preg_match("/[a-zA-Z0-9_\\-~]/", $table) && javascript::alert('模型表名只能由英文字母或数字组成');
     //model::isSysTable($table) && javascript::alert('您所填写的模块表名是系统表!请重新填写.');
     if ($id) {
         iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__model` where `table` = '{$table}' and `id`!='{$id}'") && javascript::alert('该模块已经存在!请检查是否重复');
         iCMS_DB::query("UPDATE `#iCMS@__model` SET `name` = '{$name}', `table` = '{$table}', `binding` = '{$binding}', `description` = '{$description}', `show` = '{$show}', `position` = '{$position}', `position2` = '{$position2}', `form` = '{$form}' WHERE `id` = '{$id}';");
         if (!$binding) {
             $oTable = iCMS_DB::getValue("SELECT `table` FROM `#iCMS@__model` where `id` ='{$id}'");
             if ($oTable != $table) {
                 iCMS_DB::query("RENAME TABLE `#iCMS@__" . model::tbn($oTable) . "` TO `#iCMS@__" . model::tbn($table) . "`");
             }
         }
     } else {
         iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__model` where `table` = '{$table}'") && javascript::alert('该模块已经存在!请检查是否重复');
         $field = $binding ? '' : model::$defaultField;
         iCMS_DB::query("INSERT INTO `#iCMS@__model`(`name`, `table`, `field`, `binding`, `description`,`show`, `position`,`position2`,`form`, `addtime`)VALUES ('{$name}', '{$table}','{$field}', '{$binding}', '{$description}','{$show}', '{$position}','{$position2}','{$form}', '" . time() . "');");
         $id = iCMS_DB::$insert_id;
         if (!$binding) {
             //创建模块基础表
             $tableSQL = "CREATE TABLE `#iCMS@__" . model::tbn($table) . "` (\n\t\t\t\t\t   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t   `fid` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t   `orderNum` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t\t\t   `title` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t   `clink` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t   `editor` varchar(200) NOT NULL DEFAULT '',\n\t\t\t\t\t   `userid` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t   `tags` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t   `pubdate` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t   `hits` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t   `comments` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t   `good` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t   `bad` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t   `vlink` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t   `type` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t\t\t   `top` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t\t\t   `postype` tinyint(1) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t   `status` tinyint(1) unsigned NOT NULL DEFAULT '1',\n\t\t\t\t\t   PRIMARY KEY (`id`),\n\t\t\t\t\t   KEY `pubdate` (`pubdate`),\n\t\t\t\t\t   KEY `comment` (`comments`),\n\t\t\t\t\t   KEY `hit` (`hits`),\n\t\t\t\t\t   KEY `order` (`orderNum`),\n\t\t\t\t\t   KEY `sortid` (`fid`,`id`),\n\t\t\t\t\t   KEY `topord` (`top`,`orderNum`),\n\t\t\t\t\t   KEY `userid` (`userid`),\n\t\t\t\t\t   KEY `postype` (`postype`,`id`),\n\t\t\t\t\t   KEY `status` (`status`,`postype`,`id`)\n\t\t\t\t\t ) ENGINE=MyISAM  DEFAULT CHARSET=" . DB_CHARSET;
             iCMS_DB::query($tableSQL);
         }
     }
     model::cache();
     $moreaction = array(array("text" => "下一步添加字段", "url" => __SELF__ . "?mo=models&do=addfield&id=" . $id), array("text" => "返回模块列表", "url" => __SELF__ . "?mo=models&do=manage"));
     javascript::dialog('模块' . ($id ? '编辑' : '添加') . '完成!<br />模块基础建表完成...<br />10秒后返回模块列表', "url:" . __SELF__ . "?mo=models&do=manage", $moreaction, 10);
 }
开发者ID:idreamsoft,项目名称:iCMS5.1,代码行数:46,代码来源:models.mo.php


注:本文中的model::cache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。