本文整理匯總了PHP中IO::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP IO::init方法的具體用法?PHP IO::init怎麽用?PHP IO::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IO
的用法示例。
在下文中一共展示了IO::init方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkNext
/**
* Get parent template
*
* @param string $view template string
*
* @return array
*/
public function checkNext($view)
{
$name = array();
preg_match('/@extends.+?\\)/', $view, $name);
if (!$name) {
return false;
}
$name = Helper::clean(array('@extends', '(', ')', '"', "'"), $name[0]);
$path = $this->ant->settings('view') . '/' . Helper::realPath($name) . '.' . $this->ant->settings('extension');
if (false == file_exists($path)) {
throw new Exception(sprintf('Template file not found at %s', $path));
}
$io = IO::init()->in($path);
$nextview = $io->get();
$io->out();
return array('path' => $path, 'view' => $nextview);
}
示例2: checkNext
public static function checkNext($view)
{
$name = array();
preg_match('/@extends.+?\\)/', $view, $name);
if (!$name) {
return false;
}
$name = trim(str_replace(array('@extends', '(', ')', '"', '\''), '', $name[0]));
$path = Ant::settings('view') . DIRECTORY_SEPARATOR . Helper::realPath($name) . '.' . Ant::settings('extension');
if (false == file_exists($path)) {
throw new Exception(sprintf('Template file not found at %s', $path));
}
$io = IO::init()->in($path);
$nextview = $io->get();
$io->out();
return array('path' => $path, 'view' => $nextview);
}
示例3: __destruct
/**
* Save cache file
*
* @return void
*/
public function __destruct()
{
if (true == $this->isChanged) {
IO::init()->in($this->cacheFile)->set(json_encode(self::$map, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT))->out();
}
}
示例4: draw
public function draw()
{
switch ($this->mode) {
case self::MODE_STRING:
ob_start();
extract($this->assign);
if ($this->logic_path and file_exists($this->logic_path)) {
require $this->logic_path;
}
eval(' ?>' . $this->fire('build', Parser::parse($this->fire('prepare', $this->string))) . '<?php ');
$echo = ob_get_contents();
ob_end_clean();
return $this->fire('exec', $echo);
case self::MODE_FILE:
if (false === self::$settings['freeze']) {
if (true === self::$settings['debug'] or false == self::$cache_obj->check($this->tmpl_path)) {
$io = IO::init()->in($this->tmpl_path);
$s = $this->fire('build', Parser::parse($this->fire('prepare', $io->get()), $this->tmpl_path));
$io->out()->in($this->cache_path)->set($s)->out();
}
}
unset($io, $s);
ob_start();
extract($this->assign);
if (file_exists($this->logic_path)) {
require $this->logic_path;
}
require $this->cache_path;
$echo = ob_get_contents();
ob_end_clean();
return $this->fire('exec', $echo);
}
}
示例5: Init
/**
* Необходимая инициализация и проверки(TODO)
*/
public function Init()
{
// TODO првоерка параметров php и переменных среды
//output_buffering=0 \
// basedir&
// safe_mode
// register_argc_argv="On" \
// auto_prepend_file="" \
// auto_append_file="" \
// error_reporting(0);
IO::init(ArgsHolder::get());
}
示例6: draw
/**
* Render template
*
* @return string
*/
public function draw()
{
switch ($this->mode) {
case self::MODE_STRING:
ob_start();
extract($this->assign);
if ($this->logicPath and file_exists($this->logicPath)) {
require $this->logicPath;
}
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
if (!(error_reporting() & $errno)) {
return;
}
throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
});
eval(' ?>' . $this->ant->event->fire('build', $this->parser->parse($this->ant->event->fire('prepare', $this->string))) . '<?php ');
$echo = ob_get_contents();
ob_end_clean();
restore_error_handler();
return $this->ant->event->fire('exec', $echo);
case self::MODE_FILE:
if (!$this->logicPath) {
$logicRoot = $this->ant->settings('logic');
if ($logicRoot) {
$tryLogic = $logicRoot . '/' . pathinfo($this->tmplPath, PATHINFO_FILENAME) . '.php';
if (file_exists($tryLogic)) {
$this->logicPath = $tryLogic;
}
}
}
if (false === $this->ant->settings('freeze')) {
if (true === $this->ant->settings('debug') or false == $this->ant->cache->check($this->tmplPath)) {
$io = IO::init()->in($this->tmplPath);
$s = $this->ant->event->fire('build', $this->parser->parse($this->ant->event->fire('prepare', $io->get()), $this->tmplPath));
$io->out()->in($this->cachePath)->set($s)->out();
}
}
unset($io, $s);
ob_start();
extract($this->assign);
if ($this->logicPath and file_exists($this->logicPath)) {
require $this->logicPath;
}
require $this->cachePath;
$echo = ob_get_contents();
ob_end_clean();
return $this->ant->event->fire('exec', $echo);
}
}