本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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;
}
示例5: load_mimefile
function load_mimefile($filename)
{
$file = load_file($filename);
if ($file === NULL) {
return NULL;
}
return mime_parse($file);
}
示例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);
}
示例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();
}
示例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();
}
示例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");
}
}
示例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();
}
示例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);
}
}
}
示例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);
}
示例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;
}
示例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();
}
}
示例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);
}