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


PHP cache_file函数代码示例

本文整理汇总了PHP中cache_file函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_file函数的具体用法?PHP cache_file怎么用?PHP cache_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: static_data_refresh

 function static_data_refresh()
 {
     $type = jget('type');
     if (!in_array($type, array('app', 'content', 'login', 'other', 'role', 'user', 'verify'))) {
         exit('type is invalid');
     }
     $ret = array();
     $other_logic = jlogic('other');
     $func = 'get' . ucfirst($type) . 'Statistics';
     if (method_exists($other_logic, $func)) {
         $cache_id = 'misc/' . $type . '_statistics';
         cache_file('rm', $cache_id);
         if ($type == 'other') {
             cache_file('rm', 'misc/data_length');
         }
         $ret = $other_logic->{$func}();
     }
     #生成html代码
     $head_html = "<tr class='altbg1'>";
     $body_html = "<tr class='altbg2'>";
     if ($ret) {
         foreach ($ret['data'] as $k => $v) {
             $head_html .= "<td>{$v['name']}</td>";
             $body_html .= "<td>{$v['num']}</td>";
         }
     }
     $head_html .= "</tr>";
     $body_html .= "</tr>";
     echo $head_html . $body_html;
     exit;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:31,代码来源:ajax.mod.php

示例2: get_sign_tag

 function get_sign_tag($get = 'tags')
 {
     if (false === ($rets = cache_file('get', $cache_id = $this->cache_id('list')))) {
         $rets = $this->row();
         if ($rets) {
             if ($rets['tag']) {
                 $arr = explode("\r\n", $rets['tag']);
                 $tags = array();
                 foreach ($arr as $tag) {
                     $tag = trim($tag);
                     if ($tag) {
                         $tags[$tag] = $tag;
                     }
                 }
                 $rets['tags'] = $tags;
             }
         } else {
             $rets = array();
         }
         cache_file('set', $cache_id, $rets);
     }
     if ($get && isset($rets[$get])) {
         return $rets[$get];
     }
     return $rets;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:26,代码来源:sign_tag.class.php

示例3: cache_page

function cache_page($content)
{
    if (false !== ($f = @fopen(cache_file(), 'w'))) {
        gzencode(fwrite($f, $content), 9);
        fclose($f);
    }
    return $content;
}
开发者ID:VSG24,项目名称:ccms,代码行数:8,代码来源:cache.php

示例4: cache_images

function cache_images($images)
{
    rrmdir(__DIR__ . '/img');
    mkdir(__DIR__ . '/img');
    foreach ($images as $id => $image) {
        cache_file(get_raw_url($image->path), __DIR__ . '/img/' . basename($image->path));
    }
}
开发者ID:raphaelbastide,项目名称:Website-for-1962,代码行数:8,代码来源:lib.php

示例5: cache_page

function cache_page($content)
{
    $f = fopen(cache_file(), 'w');
    if (false !== $f) {
        fwrite($f, gzcompress($content));
        fclose($f);
    }
    return $content;
}
开发者ID:KohoVolit,项目名称:legislative-openness-data-explorer,代码行数:9,代码来源:cache.php

示例6: cache_rm

 function cache_rm($mod)
 {
     $mod = jfilter($mod, 'txt');
     if ($mod) {
         parent::cache_rm($mod);
         cache_file('rm', 'role_action/' . $mod . '-0');
         cache_file('rm', 'role_action/' . $mod . '-1');
     }
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:9,代码来源:role_action.class.php

示例7: guest

 function guest()
 {
     $cache_id = 'role/guest';
     if (false === ($row = cache_file('get', $cache_id))) {
         $row = $this->row(1);
         $row['uid'] = 0;
         $row['role_id'] = 1;
         $row['nickname'] = $row['role_name'] = '游客';
         $row['username'] = 'guest';
         cache_file('set', $cache_id, $row);
     }
     return $row;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:13,代码来源:role.class.php

示例8: get_tag_by_top_topic_count

 public function get_tag_by_top_topic_count($limit, $dateline = 0, $cache_time = 0)
 {
     $tags = array();
     $limit = max(0, (int) $limit);
     if ($limit > 0) {
         $dateline = max(43200, (int) $dateline);
         $cache_time = max(300, (int) $cache_time);
         $cache_id = "misc/topic-new-tag-{$limit}-{$dateline}";
         if (!$cache_time || false === ($tags = cache_file('get', $cache_id))) {
             $tags = DB::fetch_all("select `id`,`name`,`topic_count`,`last_post` from `" . TABLE_PREFIX . "tag` \r\n\t\t\t\t\twhere `last_post` > '" . (TIMESTAMP - $dateline) . "' \r\n\t\t\t\t\torder by `topic_count` desc \r\n\t\t\t\t\tlimit {$limit}");
             if ($cache_time) {
                 cache_file('set', $cache_id, $tags, $cache_time);
             }
         }
     }
     return $tags;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:17,代码来源:tag_list.logic.php

示例9: _memberlist

 function _memberlist($where = '', $limit = 20, $orderby = 'uid', $query_link = '')
 {
     $per_page_num = (int) $limit;
     $cache_time = 300;
     $cache_id = jtable('members')->cache_id('people-_memberlist-count-' . md5($where));
     if (false === ($total_record = cache_file('get', $cache_id))) {
         $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where} ";
         $total_record = DB::result_first($sql);
         cache_file('set', $cache_id, $total_record, $cache_time);
     }
     if ($total_record > 0) {
         $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'));
         $wherelist = " {$where} order by `{$orderby}` desc {$page_arr['limit']} ";
         $cache_id = jtable('members')->cache_id('people-_memberlist-' . md5($wherelist));
         if (false === ($members = cache_file('get', $cache_id))) {
             $members = $this->TopicLogic->GetMember($wherelist, "`uid`,`ucuid`,`media_id`,`aboutme`,`username`,`nickname`,`face_url`,`face`,`validate`,`validate_category`,`province`,`city`");
             cache_file('set', $cache_id, $members, $cache_time);
         }
         $members = buddy_follow_html($members, 'uid', 'follow_html2');
     }
     $ret_ary = array('member' => $members, 'pagearr' => $page_arr);
     return $ret_ary;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:23,代码来源:people.mod.php

示例10: set_time_limit

<?php

require "system.php";
set_time_limit(30);
// Cachen von gespeicherten Übungen
if (isset($_GET['data_id'])) {
    $data = $database->query('SELECT data FROM data WHERE id = ' . intval($_GET['data_id']))->fetchColumn();
    list($url, $text) = split_data($data);
    if (!$url) {
        header("HTTP/1.1 404 Not found");
        die('<DOCTYPE HTML><h1>Not found</h1>');
    }
    try {
        $_GET['cache_id'] = cache_file($url, false, true, 3600 * 24);
    } catch (Exception $e) {
        // Geht anscheinend nicht - dann leiten wir halt weiter auf das Original
        header('Location: ' . $url);
        die;
    }
}
// Daten direkt aus dem Cache laden
$cache_id = $_GET['cache_id'];
$cache_file = $cache_dir . basename($cache_id);
$query = $database->prepare('SELECT * FROM cache WHERE id = ?');
$query->execute(array($cache_id));
$cache_object = $query->fetch(PDO::FETCH_OBJ);
if (!$cache_object || !file_exists($cache_file)) {
    header("HTTP/1.1 404 Not found");
    die('<DOCTYPE HTML><h1>Not found</h1>');
}
header('Content-disposition: attachment; filename="' . addcslashes($cache_object->filename, '"') . '"');
开发者ID:phillipberndt,项目名称:Uebungszettel,代码行数:31,代码来源:cache.php

示例11: foreach

if (is_dir('pdftk')) {
    $execute = 'LD_LIBRARY_PATH=pdftk pdftk/pdftk ';
} else {
    $execute = 'pdftk ';
}
$final_cache_id = '';
foreach ($combine as $data) {
    list($url, $title) = split_data($data['data']);
    if (!$url) {
        continue;
    }
    if (preg_match('/cache_id=([^&]+)/', $url, $match)) {
        $cache_id = basename($match[1]);
    } else {
        try {
            $cache_id = cache_file($url, false, true, 3600 * 24);
        } catch (Exception $e) {
            status_message("Dieser Dienst funktioniert nur mit PDF-Dateien");
            gotop("index.php");
        }
    }
    if (substr(get_mime_type($cache_dir . $cache_id), 0, 15) != 'application/pdf') {
        status_message("Dieser Dienst funktioniert nur mit PDF-Dateien");
        gotop("index.php");
    }
    $execute .= escapeshellarg($cache_dir . $cache_id) . ' ';
    $final_cache_id .= $cache_id;
}
$final_cache_id = sha1($final_cache_id);
$execute .= ' output ' . escapeshellarg($cache_dir . $final_cache_id);
if (!file_exists($cache_dir . $final_cache_id)) {
开发者ID:phillipberndt,项目名称:Uebungszettel,代码行数:31,代码来源:combine.php

示例12: cache_underscore

function cache_underscore() {
    cache_file(UNDERSCOREJS_URL, UNDERSCOREJS_PATH);
}
开发者ID:nrk,项目名称:macchiato,代码行数:3,代码来源:shared.php

示例13: get_maps

 function get_maps()
 {
     $cache_id = $this->cache_id('get_maps', 1);
     if (false === ($rets = cache_file('get', $cache_id))) {
         $rets = $this->get(array('sql_order' => ' `id` ASC ', 'result_list_key_is_pri' => 1));
         if ($rets['list']) {
             $min = 1;
             $table_id = '';
             foreach ($rets['list'] as $k => $v) {
                 $table_id = $v['id'];
                 $v['max'] = $v['uid'];
                 $v['min'] = $min;
                 $min = $v['max'];
                 $rets['list'][$k] = $v;
             }
             $rets['table_id'] = $table_id;
         } else {
             $rets = $rets ? $rets : array();
         }
         cache_file('set', $cache_id, $rets);
     }
     return $rets;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:23,代码来源:member_table_id.class.php

示例14: query

                print "Pages non trouv&eacute;e";
                die;
            }
        }
    } else {
        $_GET["la_langue"] = $_GET["la_langue"] != "" ? $_GET["la_langue"] : __defaultlangueid__;
        $_GET["arbre"] = 0;
        //verification si le site est publié
        $sql = "select etat_id from " . __racinebd__ . "arbre where arbre_id=" . __defaultfather__;
        $link = query($sql);
        $tbl_etat = fetch($link);
        if ($tbl_etat["etat_id"] == $_GET["etat_id"]) {
            cache_file("tpl/index.php", array($_GET, $_POST, $_SESSION), $_SERVER["PATH_INFO"]);
        } else {
            if (file_exists($_SERVER["DOCUMENT_ROOT"] . __racine__ . "tpl/maintenance.php")) {
                cache_file("tpl/maintenance.php", array($_GET, $_POST, $_SESSION), $_SERVER["PATH_INFO"]);
            } else {
                print "Site en maintenance";
                die;
            }
        }
    }
    if ($_GET["mode"] == "view") {
        ?>
    <div style="position:absolute;top:0px;left:0px;color:red;font-family:arial;font-size:12px;background:gray;font-weight:bold;padding:5px 5px 5px 5px">PREVIEW</div>
    <?php 
    }
    if (__showtime__) {
        print "<br>" . round(microtime(true) - $starttime, 2) . " s<br>";
    }
}
开发者ID:jcmwc,项目名称:fleet,代码行数:31,代码来源:index.php

示例15: Main

 function Main()
 {
     $config = jconf::get('robot');
     $order_by = $this->Get['order_by'] ? $this->Get['order_by'] : "today_times";
     $order_type = $this->Get['order_type'] ? $this->Get['order_type'] : "desc";
     $toggle_order_type = $order_type == "desc" ? "asc" : "desc";
     ${$order_by} = "order_" . $order_type;
     include_once ROOT_PATH . 'include/logic/robot.logic.php';
     $RobotRogic = new RobotLogic();
     $turnon_radio = $this->jishigou_form->YesNoRadio('config[turnon]', (int) $config['turnon'], '', 'class="radio"');
     if ($config['turnon']) {
         if (false === ($robot_list = cache_file('get', $cache_id = 'robot/list'))) {
             $sql = "SELECT * FROM " . $RobotRogic->tableName;
             $query = $this->DatabaseHandler->Query($sql);
             $robot_list = array();
             while (false != ($row = $query->GetRow())) {
                 if ($row['times'] < 10) {
                     continue;
                 }
                 $row['link'] = preg_replace("/.*?(((((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k):\\/\\/)|(www\\.))([^\\[\"'\\s\\)\\(\\;]+))|([a-z0-9\\_\\-.]+@[a-z0-9]+\\.[a-z0-9\\.]{2,}))*/i", "\\1", $row['agent']);
                 if (strpos($row['link'], '@') !== false) {
                     $row['link'] = "mailto:" . $row['link'];
                 }
                 if ($row['link'] && strpos($row['link'], ":") === false) {
                     $row['link'] = "http:/" . "/" . $row['link'];
                 }
                 $row['first_visit_timestamp'] = $row['first_visit'];
                 $row['first_visit'] = my_date_format($row['first_visit']);
                 $row['last_visit_timestamp'] = $row['last_visit'];
                 $row['last_visit'] = my_date_format($row['last_visit']);
                 if ($this->ad) {
                     $show_ad = isset($config['list'][$row['name']]['show_ad']) ? (int) $config['list'][$row['name']]['show_ad'] : 1;
                     $row['show_ad_radio'] = $this->jishigou_form->YesNoRadio("config[list][{$row['name']}][show_ad]", $show_ad, '', "class='radio'");
                 }
                 $row['today_times'] = 0;
                 $row['name'] = trim($row['name']);
                 $robot_list[$row['name']] = $row;
             }
             cache_file('set', $cache_id, $robot_list, 3600);
         }
         $name_list = array();
         foreach ($robot_list as $row) {
             if ($row['last_visit_timestamp'] + 86400 > TIMESTAMP) {
                 $name_list[] = $row['name'];
             }
         }
         if (!empty($name_list) && count($name_list) >= 0) {
             $names = jimplode($name_list);
             include_once ROOT_PATH . 'include/logic/robot_log.logic.php';
             $RobotLogLogic = new RobotLogLogic("");
             $sql = "SELECT * FROM {$RobotLogLogic->tableName}\r\n\t\t\t\twhere\r\n\t\t\t\t\t`name` in({$names})\r\n\t\t\t\t\tand `date`='{$RobotLogLogic->date}'";
             $query = $this->DatabaseHandler->Query($sql);
             while ($row = $query->GetRow()) {
                 if (isset($robot_list[$row['name']])) {
                     $robot_list[$row['name']]['today_times'] = $row['times'];
                 }
             }
         }
         if (is_array($robot_list) && sizeof($robot_list) > 0) {
             foreach ($robot_list as $key => $value) {
                 $order_by_list[$key] = $value[$order_by];
             }
             array_multisort($order_by_list, constant(strtoupper("sort_" . $order_type)), $robot_list);
         }
         if (sizeof($robot_list) > 0 && false === ($robot_ip_list = cache_file('get', $cache_id = 'robot/ip_list'))) {
             $robot_ip_list = array();
             $sql = "SELECT ip,name from {$RobotRogic->tableName}_ip GROUP BY `name` order by `last_visit` DESC";
             $query = $this->DatabaseHandler->Query($sql, "SKIP_ERROR");
             if ($query != false) {
                 while ($row = $query->GetRow()) {
                     $robot_ip_list[$row['name']][] = $row['ip'];
                 }
                 if (!empty($robot_ip_list)) {
                     foreach ($robot_ip_list as $_robot => $_ip_list) {
                         if (sizeof($_ip_list) > 5) {
                             $ip_list = array();
                             $ip_list_count = 0;
                             foreach ($_ip_list as $_ip) {
                                 $ip = substr($_ip, 0, strrpos($_ip, ".")) . ".*";
                                 $ip_list[$ip] = $ip;
                                 $ip_list_count++;
                                 if ($ip_list_count > 10) {
                                     break;
                                 }
                             }
                             $robot_ip_list[$_robot] = $ip_list;
                         }
                     }
                 }
             }
             cache_file('set', $cache_id, $robot_ip_list, 3600);
         }
     }
     include template("admin/robot");
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:95,代码来源:robot.mod.php


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