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


PHP h2o::load方法代码示例

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


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

示例1: __construct

 function __construct($file = '', $options = array())
 {
     # Init a environment
     $this->options = $this->getOptions($options);
     $loader = $this->options['loader'];
     if (!$loader) {
         return true;
     }
     if (is_object($loader)) {
         $this->loader = $loader;
         $this->loader->setOptions($this->options);
     } else {
         $loaderClass = "H2o_{$loader}_Loader";
         if (!class_exists($loaderClass)) {
             throw new Exception('Invalid template loader');
         }
         if (isset($options['searchpath'])) {
             $this->searchpath = realpath($options['searchpath']) . DS;
         } else {
             $this->searchpath = dirname(realpath($file)) . DS;
         }
         $this->loader = new $loaderClass($this->searchpath, $this->options);
     }
     if (isset($options['i18n'])) {
         $i18n_options = array();
         if (is_array($options['i18n'])) {
             $i18n_options = $options['i18n'];
         }
         h2o::load('i18n');
         $this->i18n = new H2o_I18n($this->searchpath, $i18n_options);
     }
     $this->loader->runtime = $this;
     $this->nodelist = $this->loadTemplate($file);
 }
开发者ID:bouchra012,项目名称:PMB,代码行数:34,代码来源:h2o.php

示例2: __construct

 function __construct($file = null, $options = array())
 {
     # Init a environment
     $this->options = $this->getOptions($options);
     $loader = $this->options['loader'];
     if (!$loader) {
         return true;
     }
     if (is_object($loader)) {
         $this->loader = $loader;
         $this->loader->setOptions($this->options);
     } else {
         $loader = __NAMESPACE__ . '\\' . "H2o_{$loader}_Loader";
         if (!class_exists($loader)) {
             throw new \Exception('Invalid template loader');
         }
         if (isset($options['searchpath'])) {
             $this->searchpath = realpath($options['searchpath']) . DS;
         } elseif ($file) {
             $this->searchpath = dirname(realpath($file)) . DS;
         } else {
             $this->searchpath = getcwd() . DS;
         }
         $this->loader = new $loader($this->searchpath, $this->options);
     }
     $this->loader->runtime = $this;
     if (isset($options['i18n'])) {
         h2o::load('i18n');
         $this->i18n = new H2o_I18n($this->searchpath, $options['i18n']);
     }
     if ($file) {
         $this->nodelist = $this->loadTemplate($file);
     }
 }
开发者ID:hemantshekhawat,项目名称:Snippets,代码行数:34,代码来源:h2o.php

示例3: load

 private function load()
 {
     if (isset(h2o::$extensions[$this->extension])) {
         return true;
     }
     foreach ($this->searchpath as $path) {
         $file = $path . 'ext' . DS . $this->extension . '.php';
         if (is_file($file)) {
             h2o::load($this->extension, $file);
             return $file;
         }
     }
     throw new H2o_Error("Extension: {$this->extension} cannot be loaded, please confirm it exist in extension path");
 }
开发者ID:nesicus,项目名称:mephit,代码行数:14,代码来源:tags.php

示例4: print_r

<?php

print_r(memory_get_usage());
include '../h2o.php';
h2o::load('i18n');
//// Set language to German
//$i18n = new H2o_I18n(dirname(__FILE__).DS, array(
//    'gettext_path' => dirname(__FILE__).DS.'bin/gettext/bin/'
//));
//$i18n->setLocale('fr');
//
//$i18n->extract();
//$i18n->compile();
////
// Choose domain
//extract_translations(
//   realpath('trans.tpl'), array('tpl', 'html'), dirname(__FILE__).DS.'bin/gettext/bin/'
//);
//
//compile_translations(
//   realpath('trans.tpl'), null, dirname(__FILE__).DS.'bin/gettext/bin/'
//);
$template = new H2o('trans.tpl', array('cache' => false, 'cache_dir' => dirname(__FILE__)));
$time_start = microtime(true);
for ($i = 0; $i < 10; $i++) {
    $r = $template->render(array('users' => array(array('username' => 'peter', 'tasks' => array('school', 'writing'), 'user_id' => 1), array('username' => 'anton', 'tasks' => array('go shopping'), 'user_id' => 2), array('username' => 'john doe', 'tasks' => array('write report', 'call tony', 'meeting with arron'), 'user_id' => 3), array('username' => 'foobar', 'tasks' => array(), 'user_id' => 4))));
}
echo $r;
echo "in " . (microtime(true) - $time_start) . " seconds\n<br/>";
开发者ID:paudebau,项目名称:h2o-php,代码行数:29,代码来源:index.php


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