本文整理汇总了PHP中ts_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP ts_cache函数的具体用法?PHP ts_cache怎么用?PHP ts_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ts_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDataTemp
function getDataTemp($share)
{
$typeId = $share['typeId'];
$cache = ts_cache('share_types');
if (empty($cache)) {
$cache = type_cache();
}
$temp = $cache[$typeId]['temp_list'];
$data = unserialize($share['data']);
$list_data = array_merge($share, $data);
unset($list_data['data']);
//dump($share);
if ($temp) {
foreach ($list_data as $k => $v) {
//替换
$v = h($v);
$temp = str_replace('{' . $k . '}', $v, $temp);
}
$temp = str_replace('{WR}', SITE_URL, $temp);
$temp = str_replace('{SITE_URL}', SITE_URL, $temp);
return $temp;
} else {
return '';
}
}
示例2: getChoiceList
function getChoiceList()
{
//$arrApps = ts_cache('applist');
if ($arrApps) {
return $arrApps;
} else {
$map["status"] = array('in', array(0, 1));
$list = $this->where($map)->order('order2 asc')->findAll();
foreach ($list as $key => $val) {
$APP_URL = str_replace('http://{APPS_URL}', SITE_URL . '/apps', $val['url']);
$appid = $val['id'];
$applist[$appid]['url'] = $APP_URL . '/' . $val['url_exp'];
$applist[$appid]['uid_url'] = str_replace('http://{APP_URL}', $APP_URL, $val['uid_url']);
$applist[$appid]['add_url'] = str_replace('http://{APP_URL}', $APP_URL, $val['add_url']);
$applist[$appid]['icon'] = str_replace('http://{APP_URL}', $APP_URL, $val['icon']);
$applist[$appid]['id'] = $val['id'];
$applist[$appid]['name'] = $val['name'];
$applist[$appid]['enname'] = $val['enname'];
$applist[$appid]['place'] = $val['place'];
$applist[$appid]['canvas_url'] = $val['type'];
$applist[$appid]['add_name'] = $val['add_name'];
$applist[$appid]['status'] = $val['status'];
}
ts_cache('applist', $applist);
return $applist;
}
}
示例3: _initialize
/**
* _initialize
* 初始化函数
*
* 初始化数据模型,用户ID
* @param string $aArgs 参数说明
* @access public
* @return void
*/
public function _initialize()
{
$this->model = D('Share');
$this->Cmodel = D('ShareType');
$this->types = ts_cache('share_types');
if (empty($this->types)) {
$this->types = type_cache();
}
}
示例4: updateCache
function updateCache()
{
$data = $this->where("appname='thinksns'")->findAll();
foreach ($data as $k => $v) {
$opts[$v["name"]] = $v["value"];
}
//缓存起来
ts_cache("site_options", $opts);
}
示例5: getC
function getC($name)
{
$config = ts_cache('gift_config');
if (empty($value[$name])) {
$config = D('AppConfig')->getConfig();
ts_cache('gift_config', $config);
}
return $config[$name];
}
示例6: getGuestPopedom
function getGuestPopedom()
{
$list = ts_cache('guestpopedom');
if (!$list) {
$list = $this->getNodeList(0);
ts_cache('guestpopedom', $list);
}
return $list;
}
示例7: getCreditType
public function getCreditType()
{
$cache = ts_cache('credit_type');
if (!$cache) {
$cache = $this->getAllType();
//存储缓存
ts_cache('credit_type', $cache);
}
return $cache;
}
示例8: render
public function render($data)
{
$bq_emotion = ts_cache('smile_mini');
$data['next'] = "下一页";
$data['prev'] = "上一页";
$data['perpage'] = 10;
$data['bq_emotion'] = $bq_emotion;
$content = $this->renderFile("Comment", $data);
return $content;
}
示例9: getSmile
public function getSmile($type)
{
$smile = ts_cache("smile_mini");
if ($smile) {
return $smile;
} else {
$data = $this->where("type='mini'")->findAll();
return $data;
//return $this->setCache( $data,$type );
}
}
示例10: get
function get()
{
$opts = ts_cache("site_options");
if (!$opts) {
$map['appname'] = 'thinksns';
$data = $this->where($map)->findAll();
foreach ($data as $k => $v) {
$opts[$v["name"]] = $v["value"];
}
//缓存起来
ts_cache("site_options", $opts);
}
return $opts;
}
示例11: replaceContent
/**
* replaceContent
* 替换内容
* @param mixed $content
* @access private
* @return void
*/
private function replaceContent($content, $type)
{
//TODO 每一个应用可以应用一套表情
$path = __PUBLIC__ . "/images/biaoqing/mini/";
//路径
$smile = ts_cache("smile_mini");
//循环替换掉文本中所有ubb表情
foreach ($smile as $value) {
$img = sprintf("<img title='%s' src='%s%s'>", $value['title'], $path, $value['filename']);
$content = str_replace($value['emotion'], $img, $content);
}
return $content;
}
示例12: _setCache
/**
* _setCache
* 设置缓存
* @param mixed $id
* @param mixed $uid
* @access private
* @return void
*/
private function _setCache()
{
$this->_cache['endTime'] = time() + self::$lefttime;
return ts_cache(self::$type . 'browse', $this->_cache);
}
示例13: setCache
public function setCache()
{
$cache = $this->getAllType();
//存储缓存
ts_cache('credit_type', $cache);
}
示例14: upCache
protected function upCache()
{
ts_cache('applist', '');
}
示例15: dobackup
function dobackup()
{
$volume = isset($_GET['volume']) ? intval($_GET['volume']) + 1 : 1;
$filename = date('ymd') . '_' . substr(md5(uniqid(rand())), 0, 10);
$tables = array();
$type = $_REQUEST['type'];
if ($type == 'all') {
//备份所有数据
$tables = D('BackUp')->getTableList();
$tables = D('BackUp')->arraykey($tables, 'Name');
} elseif ($type == 'custom') {
if ($_POST['setup']) {
$tables = empty($_REQUEST['tablecustom']) ? array() : $_REQUEST['tablecustom'];
ts_cache('tablecustom', $tables);
//放入缓存
} else {
$tables = ts_cache('tablecustom');
}
}
$filename = trim($_REQUEST['filename']) ? trim($_REQUEST['filename']) : $filename;
$startfrom = intval($_REQUEST['startform']);
$tableid = intval($_REQUEST['tableid']);
$sizelimit = intval($_REQUEST['sizelimit']) ? intval($_REQUEST['sizelimit']) : 1000;
$tablenum = count($tables);
$filesize = $sizelimit * 1000;
$complete = true;
$tabledump = '';
if ($tablenum == 0) {
$this->error('请选择备份的表');
}
for (; $complete && $tableid < $tablenum && strlen($tabledump) + 500 < $filesize; $tableid++) {
$sqlDump = D('BackUp')->sqlDumpTable($tables[$tableid], $startfrom, $filesize, strlen($tabledump), $complete);
$tabledump .= $sqlDump['tabledump'];
$complete = $sqlDump['complete'];
$startfrom = intval($sqlDump['startform']);
if ($complete) {
$startfrom = 0;
}
}
!$complete && $tableid--;
if (trim($tabledump)) {
$filepath = './data/database/' . $filename . "_{$volume}" . '.sql';
$fp = @fopen($filepath, 'wb');
if (!fwrite($fp, $tabledump)) {
//$this->error('文件目录写入失败');
} else {
$url = __APP__ . "/Expert/dobackup/filename/{$filename}/type/{$type}/sizelimit/{$sizelimit}/tableid/{$tableid}/startform/{$startfrom}/volume/{$volume}";
file_put_contents('1.txt', $url);
//header('Location:$ur;');
$this->assign('jumpUrl', $url);
$this->success("备份第{$volume}卷成功");
}
} else {
$url = __APP__ . "/Expert/backup";
$this->assign('jumpUrl', $url);
$this->success("备份成功");
}
}