本文整理汇总了PHP中h2o::parseString方法的典型用法代码示例。如果您正苦于以下问题:PHP h2o::parseString方法的具体用法?PHP h2o::parseString怎么用?PHP h2o::parseString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类h2o
的用法示例。
在下文中一共展示了h2o::parseString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: should_apply_filter_if_available
function should_apply_filter_if_available()
{
$name = 'taylor luk';
$result = h2o::parseString('{{ name|capitalize }}')->render(compact('name'));
expects($result)->should_be('Taylor Luk');
}
示例2: __construct
function __construct($argstring, $parser, $position = 0)
{
if (!preg_match($this->syntax, $argstring, $matches)) {
throw new TemplateSyntaxError();
}
$matches_count = count($matches);
if ($matches_count > 2) {
// "with" statement supplied.
$with_vars = explode(' ', $matches[3]);
foreach ($with_vars as $var_str) {
$eq_pos = strpos($var_str, '=');
$this->_additional_context[substr($var_str, 0, $eq_pos)] = substr($var_str, $eq_pos + 1);
}
}
$this->filename = stripcslashes($matches[1]);
$this->fname_tpl = h2o::parseString($this->filename, $parser->options);
if ($this->fname_tpl->render() != $this->filename) {
$this->dynamic = True;
$this->loader = $parser->runtime;
} else {
$this->dynamic = False;
$this->nodelist = $parser->runtime->loadSubTemplate($this->filename, $parser->options);
$parser->storage['templates'] = array_merge($this->nodelist->parser->storage['templates'], $parser->storage['templates']);
$parser->storage['templates'][] = $this->filename;
}
}