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


PHP F3::run方法代码示例

本文整理汇总了PHP中F3::run方法的典型用法代码示例。如果您正苦于以下问题:PHP F3::run方法的具体用法?PHP F3::run怎么用?PHP F3::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在F3的用法示例。


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

示例1: sitemap

 /**
 		Parse each URL recursively and generate sitemap
 			@param $_url string
 			@public
 	**/
 public static function sitemap($_url = '/')
 {
     $_map =& F3::$global['SITEMAP'];
     if (array_key_exists($_url, $_map) && $_map[$_url]['status'] !== NULL) {
         // Already crawled
         return;
     }
     preg_match('/^http[s]*:\\/\\/([^\\/$]+)/', $_url, $_host);
     if (!empty($_host) && $_host[1] != $_SERVER['SERVER_NAME']) {
         // Remote URL
         $_map[$_url]['status'] = FALSE;
         return;
     }
     F3::$global['QUIET'] = TRUE;
     F3::mock('GET ' . $_url);
     F3::run();
     // Check if an error occurred or no HTTP response
     if (F3::$global['ERROR'] || !F3::$global['RESPONSE']) {
         $_map[$_url]['status'] = FALSE;
         // Reset error flag for next page
         unset(F3::$global['ERROR']);
         return;
     }
     $_doc = new XMLTree('1.0', F3::$global['ENCODING']);
     if ($_doc->loadHTML(F3::$global['RESPONSE'])) {
         // Valid HTML; add to sitemap
         if (!$_map[$_url]['level']) {
             // Web root
             $_map[$_url]['level'] = 0;
         }
         $_map[$_url]['status'] = TRUE;
         $_map[$_url]['mod'] = time();
         $_map[$_url]['freq'] = 0;
         // Cached page
         $_hash = 'url.' . F3::hashCode('GET ' . $_url);
         $_cached = Cache::cached($_hash);
         if ($_cached) {
             $_map[$_url]['mod'] = $_cached['time'];
             $_map[$_url]['freq'] = $_SERVER['REQUEST_TTL'];
         }
         // Parse all links
         $_links = $_doc->getElementsByTagName('a');
         foreach ($_links as $_link) {
             $_ref = $_link->getAttribute('href');
             $_rel = $_link->getAttribute('rel');
             if (!$_ref || $_rel && preg_match('/nofollow/', $_rel)) {
                 // Don't crawl this link!
                 continue;
             }
             if (!array_key_exists($_ref, $_map)) {
                 $_map[$_ref] = array('level' => $_map[$_url]['level'] + 1, 'status' => NULL);
             }
         }
         // Parse each link
         array_walk(array_keys($_map), 'self::sitemap');
     }
     unset($_doc);
     if (!$_map[$_url]['level']) {
         // Finalize sitemap
         $_depth = 1;
         while ($_ref = current($_map)) {
             // Find depest level while iterating
             if (!$_ref['status']) {
                 // Remove remote URLs and pages with errors
                 unset($_map[key($_map)]);
             } else {
                 $_depth = max($_depth, $_ref['level'] + 1);
                 next($_map);
             }
         }
         // Create XML document
         $_xml = simplexml_load_string('<?xml version="1.0" encoding="' . F3::$global['ENCODING'] . '"?>' . '<urlset xmlns="' . 'http://www.sitemaps.org/schemas/sitemap/0.9' . '"/>');
         $_host = 'http://' . $_SERVER['SERVER_NAME'];
         foreach ($_map as $_key => $_ref) {
             // Add new URL
             $_item = $_xml->addChild('url');
             // Add URL elements
             $_item->addChild('loc', $_host . $_key);
             $_item->addChild('lastMod', date('c', $_ref['mod']));
             $_item->addChild('changefreq', self::frequency($_ref['freq']));
             $_item->addChild('priority', sprintf('%1.1f', 1 - $_ref['level'] / $_depth));
         }
         // Send output
         F3::$global['QUIET'] = FALSE;
         if (PHP_SAPI != 'cli' && !headers_sent()) {
             header(F3::HTTP_Content . ': application/xhtml+xml; ' . 'charset=' . F3::$global['ENCODING']);
         }
         $_xml = dom_import_simplexml($_xml)->ownerDocument;
         $_xml->formatOutput = TRUE;
         echo $_xml->saveXML();
     }
 }
开发者ID:seyyah,项目名称:f3kulmysql,代码行数:97,代码来源:expansion.php

示例2: COPYRIGHT

          _ _,---._ 
       ,-','       `-.___ 
      /-;'               `._ 
     /\/          ._   _,'o \ 
    ( /\       _,--'\,','"`. )                     
     |\      ,'o     \'    //\         
     |      \        /   ,--'""`-. 
     :       \_    _/ ,-'         `-._ 
      \        `--'  /                ) 
       `.  \`._    ,'     ________,',' 
         .--`     ,'  ,--` __\___,;'           
          \`.,-- ,' ,`_)--'  /`.,'             
           \( ;  | | )      (`-/                _        _                      _
             `--'| |)       |-/                | |      | |                    | |
               | | |        | |                | |      | | COPYRIGHT (c) 2015 | |
               | | |,.,-.   | |_               | | _____| | _____  ___  ___  __| |
               | `./ /   )---`  )              | |/ / _ \ |/ / _ \/ __|/ _ \/ _` |
              _|  /    ,',   ,-'               |   <  __/   <  __/\__ \  __/ (_| |
     -hrr-   ,'|_(    /-<._,' |--,             |_|\_\___|_|\_\___||___/\___|\__,_|
             |    `--'---.     \/ \            
             |          / \    /\  \           https://www.kekesed.gq/
           ,-^---._     |  \  /  \  \          iam@kekesed.gq
        ,-'        \----'   \/    \--`. 
       /            \              \   \ 
*/
$_play = array("/app/f3/base.php", "/app/router.php");
foreach ($_play as $file) {
    require __DIR__ . $file;
}
F3::run();
开发者ID:Kekesed,项目名称:Kambeng-Blog,代码行数:30,代码来源:index.php


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