⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 08c10-2.php

📁 介绍PHP5的给类型函数应用
💻 PHP
字号:
<?php// We are going to be outputting a graphic so start with the proper headersheader('Content-type: image/jpeg');// Register a shutdown function, so if we fail, the basic file is returnedfunction shutdown() {    // If we never managed to read the file:    if (!(isset($GLOBALS['data'])) || !($GLOBALS['data'])) {        // Output the cached file, ensure a full absolute path:        readfile(dirname(__FILE__) . '/hubble_news.cache');    }}register_shutdown_function('shutdown');// Set a quick timeout value so if we don't get it quickly it uses the cacheset_time_limit(5);// Try to read in the remote file:if ($data = @file_get_contents(        'http://hubblesite.org/news/latest_big.php')) {    // Quickly reset the timer so we don't timeout while writing the cache    set_time_limit(60);    // We got the file, so echo out the contents    echo $data;    // Now we need to save this to the cache file as well.    // Give file_put_contents the LOCK_EX flag which makes it    // attempt to get an exclusive lock before writing to the file.    ignore_user_abort(true);    file_put_contents(dirname(__FILE__) . '/hubble_news.cache',         $data, LOCK_EX);}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -