當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Component::get方法代碼示例

本文整理匯總了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;
 }
開發者ID:komponen,項目名稱:yii2-postman,代碼行數:34,代碼來源:ViewLetter.php

示例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;
 }
開發者ID:anggadjava,項目名稱:payroll,代碼行數:10,代碼來源:component.php

示例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';
     }
 }
開發者ID:ScalateKids,項目名稱:Scalatetrack,代碼行數:13,代碼來源:components_controller.php

示例4:

<?php

echo Component::get('head');
?>
<body>

    <?php 
echo Layout::content();
?>

</body>
</html>
開發者ID:spire-framework,項目名稱:app,代碼行數:12,代碼來源:app.layout.php

示例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);
 }
開發者ID:anggadjava,項目名稱:payroll,代碼行數:13,代碼來源:components.php


注:本文中的Component::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。