本文整理匯總了PHP中think\Storage::read方法的典型用法代碼示例。如果您正苦於以下問題:PHP Storage::read方法的具體用法?PHP Storage::read怎麽用?PHP Storage::read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類think\Storage
的用法示例。
在下文中一共展示了Storage::read方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public function run(&$params)
{
// 開啟靜態緩存
if (IS_GET && C('HTML_CACHE_ON')) {
$cacheTime = $this->requireHtmlCache();
if (false !== $cacheTime && $this->checkHTMLCache(HTML_FILE_NAME, $cacheTime)) {
$mtime = self::fileMTime(HTML_FILE_NAME);
if (!empty($_SERVER['HTTP_IF_NONE_MATCH'])) {
if ($_SERVER['HTTP_IF_NONE_MATCH'] >= $mtime) {
header('Etag:' . $_SERVER['HTTP_IF_NONE_MATCH'], true, 304);
exit;
}
self::httpCached($mtime, false);
} else {
self::httpCached($mtime);
}
header('Etag:' . $mtime, true, 200);
//靜態頁麵有效
// 讀取靜態頁麵輸出
echo Storage::read(HTML_FILE_NAME, 'html');
exit;
}
$mtime = NOW_TIME + 5;
header('Etag:' . $mtime, true, 200);
self::httpCached($mtime, false);
}
}
示例2: run
public function run(&$params)
{
// 開啟靜態緩存
if (IS_GET && C('HTML_CACHE_ON')) {
$cacheTime = $this->requireHtmlCache();
if (false !== $cacheTime && $this->checkHTMLCache(HTML_FILE_NAME, $cacheTime)) {
//靜態頁麵有效
// 讀取靜態頁麵輸出
echo Storage::read(HTML_FILE_NAME, 'html');
exit;
}
}
}
示例3: run
public function run(&$content)
{
if (!APP_DEBUG && C('BUILD_LITE_RUNTIME')) {
$litefile = RUNTIME_PATH . APP_MODE . '~lite.php';
$runtimefile = RUNTIME_PATH . APP_MODE . '~runtime.php';
if (!Storage::has($litefile)) {
$defs = get_defined_constants(TRUE);
$content = Storage::read($runtimefile);
// $content .= 'namespace { $GLOBALS[\'_beginTime\'] = microtime(TRUE);';
$content .= compile(CORE_PATH . 'Think' . EXT);
$content .= 'namespace {' . $this->array_define($defs['user']) . 'Think\\Think::start();}';
Storage::put($litefile, $content);
}
}
}
示例4: file_read
/**
* 文件內容讀取
* @param string $filename 文件名
* @param string $type 其他參數
* @return bool
*/
function file_read($filename, $type = '')
{
switch (strtoupper(C('FILE_UPLOAD_TYPE'))) {
case 'SAE':
$arr = explode('/', ltrim($filename, './'));
$domain = array_shift($arr);
$filePath = implode('/', $arr);
$s = new SaeStorage();
return $s->read($domain, $filePath);
break;
case 'FTP':
$storage = new \Common\Plugin\Ftp();
return $storage->read($filename);
break;
default:
return \Think\Storage::read($filename, $type);
}
}
示例5: fileView
/**
* 文件查看
*/
public function fileView($filename)
{
$filename = urldecode($filename);
$filename = $this->fileBathPath . $filename;
if (\Think\Storage::has($filename)) {
echo str_replace(array("\n", "\t"), array('<br />', ' '), htmlspecialchars(\Think\Storage::read($filename)));
}
}
示例6: file_read
/**
* 文件內容讀取
* @param string $filename 文件名
* @return boolean
*/
function file_read($filename, $type = '')
{
switch (STORAGE_TYPE) {
case 'Sae':
$arr = explode('/', ltrim($filename, './'));
$domain = array_shift($arr);
$filePath = implode('/', $arr);
$s = new SaeStorage();
return $s->read($domain, $filePath);
break;
default:
return \Think\Storage::read($filename, $type);
}
}