本文整理汇总了PHP中f::load方法的典型用法代码示例。如果您正苦于以下问题:PHP f::load方法的具体用法?PHP f::load怎么用?PHP f::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类f
的用法示例。
在下文中一共展示了f::load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$file = $this->root . DS . str_replace('.', DS, $this->file) . '.php';
if (!file_exists($file)) {
throw new Exception('Invalid view: ' . $this->file);
}
return f::load($file, $this->data);
}
示例2: load
/**
* Safely requires a file if it exists
*
* @param array $data Optional variables, which will be made available to the file
*/
public function load($data = array())
{
return f::load($this->root, $data);
}
示例3: str_replace
include 'lib/' . str_replace('\\', '/', $class) . '.php';
}
});
$instagram = new Instagram();
$kirby = $this;
$this->options['routes'][] = array('pattern' => 'kirbygram/install', 'method' => 'GET', 'action' => function ($path = null) use($instagram, $kirby) {
if (!$instagram->is_installed()) {
return f::load(__DIR__ . '/templates/install.php', array('instagram' => $instagram));
}
return false;
});
$this->options['routes'][] = array('pattern' => 'kirbygram/done', 'method' => 'GET', 'action' => function ($path = null) use($instagram) {
if ($instagram->is_installed()) {
return f::load(__DIR__ . '/templates/complete.php', array('instagram' => $instagram));
} else {
return f::load(__DIR__ . '/templates/error.php', array('instagram' => $instagram));
}
});
$this->options['routes'][] = array('pattern' => 'kirbygram/complete', 'method' => 'POST', 'action' => function ($path = null) use($instagram) {
if (!$instagram->is_installed()) {
//write to cache
$data = $_POST;
if ($data['kgt'] == $instagram->get_config('csrf')) {
if ($data['token'] && $data['user']) {
$instagram->set_config(array('token' => $data['token'], 'user' => $data['user'], 'uid' => $data['uid'], 'installed' => true));
}
$instagram->save_config();
}
exit;
}
return false;
示例4: content
/**
* Get the generated view content.
*
* @return string
*/
public function content()
{
ob_start();
f::load($this->file, $this->scope);
$output = ob_get_contents();
ob_end_clean();
return $output;
}