當前位置: 首頁>>代碼示例>>PHP>>正文


PHP load_file函數代碼示例

本文整理匯總了PHP中load_file函數的典型用法代碼示例。如果您正苦於以下問題:PHP load_file函數的具體用法?PHP load_file怎麽用?PHP load_file使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了load_file函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: load_file

function load_file($url, $frequency = 3600, $cachefn = '')
{
    $fcont = false;
    if (!preg_match('|^http://([\\w]+)\\.deviantart\\.com[\\w/._]*|', $url)) {
        die("Error: couldn't open {$url}!");
    }
    if ($cachefn !== '') {
        $cache = '.cache/' . $cachefn;
    } else {
        $cache = '.cache/' . preg_replace('/[^a-z0-9\\.]/i', '', $url) . '.cache';
    }
    if (file_exists($cache) && time() - filemtime($cache) <= $frequency) {
        $fcont = file_get_contents($cache);
    } else {
        if (($fcont = get_page($url)) === false) {
            if (file_exists($cache)) {
                touch($cache);
                return load_file($url);
            } else {
                die("Error: couldn't open {$url}!");
            }
        }
        file_put_contents($cache, $fcont, LOCK_EX);
    }
    return $fcont;
}
開發者ID:raisanen,項目名稱:jce,代碼行數:26,代碼來源:load_file.php

示例2: Main

function Main()
{
    $src_file = fopen("../GMS_LANG_SRC_" . date("Ymdhis") . ".txt", "w");
    load_file($src_file, "../chinese_simple/sys_config.php");
    load_file($src_file, "../chinese_simple/page_localized.php");
    fclose($src_file);
}
開發者ID:svn2github,項目名稱:ybtx,代碼行數:7,代碼來源:Encoding.php

示例3: init

 /**
  * Inisialisasi controller
  * @param String $access = 'site' atau 'admin'
  * @param Boolean $debug, $cache = smarty config
  * @param Integer $cache_lifetime = smarty config
  * @access protected  
  */
 protected function init($access, $link = '', $debug = false, $cache = false, $cache_lifetime = 120)
 {
     self::$instance = $this;
     $this->load = new Z_Loader();
     $this->base_link = base_link_format($link);
     load_file(ENGINE_PATH . 'smarty' . DS . 'libs' . DS, 'Smarty.class.php');
     if (!class_exists('Smarty')) {
         die('Smarty class not found !');
     }
     $this->view = new Smarty();
     if ($access == 'site') {
         $name = $this->theme_dir('site_theme_name', 'site');
         $this->view->template_dir = $this->theme_dir('site_theme_path', 'site');
     } else {
         if ($access == 'admin') {
             $name = $this->theme_dir('site_theme_name', 'admin');
             $this->view->template_dir = $this->theme_dir('site_theme_path', 'admin');
         } else {
             die('Wrong access !');
         }
     }
     $this->view->compile_dir = TEMP_PATH . 'smarty' . DS . 'templates_c' . DS;
     $this->view->config_dir = TEMP_PATH . 'smarty' . DS . 'configs' . DS;
     $this->view->cache_dir = TEMP_PATH . 'smarty' . DS . 'cache' . DS;
     $this->view->plugins_dir = ENGINE_PATH . 'plugin' . DS . 'smarty' . DS . 'plugins' . DS;
     $this->view->debugging = $debug;
     $this->view->caching = $cache;
     $this->view->cache_lifetime = $cache_lifetime;
     $this->require_files($access);
     $this->view->assign('THEME_DIR', $name);
 }
開發者ID:asmari,項目名稱:zcosp,代碼行數:38,代碼來源:controller.php

示例4: create

 /**
  * 生成靜態頁麵
  * @param type $arg     生成靜態數據
  * array(控製器名,方法名,表態數據,保存表態文件路徑)
  * array(news,show,1,'h/b/hd.html');表示生成news控製器中的show方法生成ID為1的文章
  */
 public function create($control, $method, $data)
 {
     $control = rtrim($control, C("CONTROL_FIX"));
     $file = get_control_file($control . C('CONTROL_FIX'));
     load_file($file[0]);
     $className = $file[1] . C("CONTROL_FIX");
     $obj = new $className();
     // $obj->$method();
     //        $GLOBALS['html_control'] = $control;
     //        $GLOBALS['html_method'] = $method;
     foreach ($data as $v) {
         //設置GET參數
         ob_start();
         foreach ($v as $m => $n) {
             $_GET[$m] = $n;
         }
         if (!isset($v['html_file'])) {
             //驗證是否含有html_file內容,即生成文件的名子
             error(L("html_create_error1"), false);
             return false;
         }
         $dirname = dirname($v['html_file']);
         if (!$this->createDir($dirname)) {
             //創建一下生成靜態的目錄
             error(L("html_create_error2"));
             return false;
         }
         $obj->{$method}();
         //執行控製器方法
         $content = ob_get_clean();
         file_put_contents($v['html_file'], $content);
     }
     return true;
 }
開發者ID:com-itzcy,項目名稱:hdjob,代碼行數:40,代碼來源:html.class.php

示例5: load_mimefile

function load_mimefile($filename)
{
    $file = load_file($filename);
    if ($file === NULL) {
        return NULL;
    }
    return mime_parse($file);
}
開發者ID:nbtscommunity,項目名稱:phpfnlib,代碼行數:8,代碼來源:mimefile.php

示例6: Main

function Main()
{
    $lang = "english";
    $src_file = fopen("../GMS_LANG_SRC_" . $lang . "_" . date("Ymdhis") . ".txt", "w");
    load_file($src_file, $lang, "sys_config.php");
    load_file($src_file, $lang, "page_localized.php");
    fclose($src_file);
}
開發者ID:svn2github,項目名稱:ybtx,代碼行數:8,代碼來源:Merge.php

示例7: _getStructureFromBaseRepoFile

 private function _getStructureFromBaseRepoFile($fileName)
 {
     $objBaseRepositoryName = str_replace('.php', '', $fileName);
     $objBaseRepositoryName = NamingConvention::snakeCaseToCamelCaseFirstUpper($objBaseRepositoryName) . 'sitory';
     load_file($this->_baseRepoDir . $fileName);
     $objRepository = new $objBaseRepositoryName();
     return $objRepository->getStructure();
 }
開發者ID:RobinTheHood,項目名稱:php-framework,代碼行數:8,代碼來源:dependency.php

示例8: getDriver

 /**
  * 獲得數據庫驅動接口
  * @param string $driver
  */
 private function getDriver($driver)
 {
     $class = $driver . 'SessionDriver';
     //數據庫驅動
     $classFile = PATH_HD . '/libs/usr/session/driver/' . $class . '.class.php';
     //加載驅動類庫文件
     load_file($classFile);
     $this->driver[$driver] = new $class();
 }
開發者ID:com-itzcy,項目名稱:hdjob,代碼行數:13,代碼來源:sessionFactory.class.php

示例9: importar_data

 protected function importar_data()
 {
     $ruta = "//199.69.69.93\\interfaces_cedentes\\Cargas Procesos\\APLICACIONES\\UVM_CARSIT\\ENTRADA";
     $listado = get_dir_file_info($ruta);
     foreach ($listado as $key => $value) {
         $r = $listado[$key];
         $this->data[$r["name"]] = load_file($r["server_path"], null, "dia");
     }
 }
開發者ID:bsanchezdev,項目名稱:p_solvencia,代碼行數:9,代碼來源:uvm_c_robot_panel.php

示例10: getDriver

 /**
  * 獲得數據庫驅動接口
  * @param string $driver
  */
 private function getDriver($driver)
 {
     $class = $driver . 'Cache';
     //緩存驅動
     $classFile = PATH_HD . '/libs/usr/cache/driver/' . $class . '.class.php';
     //加載驅動類庫文件
     load_file($classFile);
     $this->driver_list[$driver] = new $class();
 }
開發者ID:com-itzcy,項目名稱:hdjob,代碼行數:13,代碼來源:cacheFactory.class.php

示例11: load_dir_files

 function load_dir_files($dir_path)
 {
     $files = scandir($dir_path);
     $dir_path = preg_match("/\\/\\z/", $dir_path) ? $dir_path : $dir_path . DS;
     foreach ($files as $file_name) {
         if (is_file($dir_path . $file_name)) {
             load_file($dir_path . $file_name);
         }
     }
 }
開發者ID:jameshwartlopez,項目名稱:Elixir-System,代碼行數:10,代碼來源:Functions.php

示例12: getDriver

 /**
  * 獲得數據庫驅動接口
  * @param string $driver
  */
 private function getDriver($driver, $tableName)
 {
     $class = $driver . 'Driver';
     //數據庫驅動
     $classFile = PATH_HD . '/libs/usr/db/driver/' . $class . '.class.php';
     //加載驅動類庫文件
     load_file($classFile);
     $this->driver_list[$tableName] = new $class();
     $table = $tableName == 'empty' ? null : $tableName;
     $this->driver_list[$tableName]->connect($table);
 }
開發者ID:com-itzcy,項目名稱:hdjob,代碼行數:15,代碼來源:dbFactory.class.php

示例13: load

 public static function load($name, $section = 'default')
 {
     static $caches = [];
     if (isset($caches[$key = "{$name}--{$section}"])) {
         return $caches[$key];
     }
     $conf = yaml_parse(load_file(ROOT . "/conf/default/{$name}.yml"))[$section];
     if (is_file($file = ROOT . "/conf/{$name}.yml")) {
         $conf = array_replace_recursive($conf, yaml_parse(load_file($file))[$section]);
     }
     return $caches[$key] = $conf;
 }
開發者ID:tany,項目名稱:php-note,代碼行數:12,代碼來源:Config.php

示例14: __construct

 /**
  * Constructor
  *
  * @args[0] $filename represents name and location
  */
 function __construct()
 {
     $this->elementObjects = array();
     $this->lineStore = array();
     $args = func_get_args();
     if (!empty($args)) {
         $this->filename = $args[0];
         $this->load(load_file($this->filename));
     } else {
         $this->filemodtime = time();
     }
 }
開發者ID:bwssytems,項目名稱:domuslink,代碼行數:17,代碼來源:elementfile.class.php

示例15: safe_load

/**
 *  Load data from safe by hash
 */
function safe_load($hash)
{
    $file_content = load_file(make_file_name($hash));
    if ($file_content === false) {
        return false;
    }
    $data = json_decode($file_content);
    if ($data === false) {
        return false;
    }
    return safe_normalize_data($data);
}
開發者ID:ah01,項目名稱:jq-probe,代碼行數:15,代碼來源:safe.inc.php


注:本文中的load_file函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。