本文整理汇总了PHP中Component::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::get方法的具体用法?PHP Component::get怎么用?PHP Component::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setBodyFromView
/**
* @param string $view view file name or alias
* @param array $data
* @param string $viewPath
* @return static
* @throws \rmrevin\yii\postman\LetterException
*/
public function setBodyFromView($view, $data = [], $viewPath = null)
{
$controller = \Yii::$app->controller;
if (!empty($controller)) {
$viewPath = isset($controller->module) && $controller->module !== null ? $controller->module->getViewPath() : $controller->getViewPath();
}
if (empty($viewPath)) {
$viewPath = \Yii::$app->basePath . '/views';
}
if (strncmp($view, '@', 1) === 0) {
// example $view = '@app/view/email/letter-text.php'
$path = \Yii::getAlias($view);
} else {
// example $view = 'letter-text';
// expand to '/app/views/email/letter-text.php'
// or '/app/modules/ModuleName/views/email/letter-text.php'
$path = \Yii::getAlias($viewPath) . Component::get()->view_path . DIRECTORY_SEPARATOR . $view . '.php';
}
if (!file_exists($path)) {
throw new LetterException(\Yii::t('app', 'View file «{path}» not found.', ['path' => $path]));
} else {
$data['_code'] = $this->code;
$data['_subject'] = $this->raw_subject;
$this->body = \Yii::$app->getView()->renderFile($path, $data);
}
return $this;
}
示例2: Component
function list_drop()
{
$component = new Component();
$component->get();
foreach ($component as $row) {
$data[''] = '[ Components ]';
$data[$row->comp_id] = $row->comp_name . ' - ' . $row->comp_type;
}
return $data;
}
示例3: alter
public function alter()
{
if (!isset($_SESSION['logged'])) {
return call('pages', 'home');
} else {
if (!isset($_GET['code'])) {
return call('pages', 'error', 2);
}
$requirements = Requirement::all();
$component = Component::get($_GET['code']);
require_once 'views/components/alter.php';
}
}
示例4:
<?php
echo Component::get('head');
?>
<body>
<?php
echo Layout::content();
?>
</body>
</html>
示例5: Component
function get_components()
{
$component = new Component();
$components = $component->get()->all;
$data = array();
$i = 0;
foreach ($components as $x) {
$data[$i]["comp_name"] = $x->comp_name;
$data[$i]["comp_type"] = $x->comp_type;
$i++;
}
echo json_encode($data);
}