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


PHP HomeController類代碼示例

本文整理匯總了PHP中HomeController的典型用法代碼示例。如果您正苦於以下問題:PHP HomeController類的具體用法?PHP HomeController怎麽用?PHP HomeController使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了HomeController類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 function __construct()
 {
     $url = isset($_GET['url']) ? $_GET['url'] : null;
     $url = rtrim($url, '/');
     $url = explode('/', $url);
     if (empty($url[0])) {
         require 'Controller/HomeController.php';
         $controller = new HomeController();
         $controller->index();
         return false;
     }
     $file = 'Controller/' . ucfirst($url[0]) . 'Controller.php';
     if (file_exists($file)) {
         require $file;
     } else {
         throw new Exception("The file: {$file} Does not exists");
     }
     $controller_url = ucfirst($url[0]) . "Controller";
     $controller = new $controller_url();
     // Carregando o Modelo
     $controller->loadModel($controller_url);
     // Verificar se foi especificado um método (action)
     if (isset($url[2])) {
         // adicionar parametro no método
         $controller->{$url[1]}($url[2]);
     } else {
         if (isset($url[1])) {
             $controller->{$url[1]}();
         } else {
             $controller->index();
         }
     }
 }
開發者ID:bigandhugemistake,項目名稱:condesa,代碼行數:33,代碼來源:Core.php

示例2: logout

 public function logout()
 {
     session_start();
     session_unset();
     $home = new HomeController();
     return $home->index();
 }
開發者ID:navi15486,項目名稱:MusicMVC,代碼行數:7,代碼來源:loginController.php

示例3: save

 function save()
 {
     include "config/site.php";
     if ($commentswitch === "0") {
         echo "-1";
         return;
     }
     session_start();
     if (strcasecmp($_POST['validationCode'], $_SESSION['validationCode']) != 0) {
         echo "0";
         return;
     }
     $this->reply = new Reply();
     $this->reply->save();
     include "config/site.php";
     $model = new BaseModel();
     //reconnect to the msyql
     $fname = $tpl_root . "/static/" . $_POST['par_id'] . ".html";
     ob_start();
     $_GET["id"] = $_POST['par_id'];
     $home = new HomeController();
     $home->info();
     $content = ob_get_contents();
     ob_end_clean();
     $fp = fopen($fname, "w");
     fwrite($fp, $content);
     fclose($fp);
     echo "true";
 }
開發者ID:puregamexyz,項目名稱:bitdesign.github.io,代碼行數:29,代碼來源:ReplyController.php

示例4: fire

 /**
  * Execute the console command.
  * Creates a HomeController and calls its cleanLeases function which terminates all expired leases.
  *
  * @return mixed
  */
 public function fire()
 {
     $home_controller = new HomeController(new LaravelDuo\LaravelDuo());
     $cleaner = $home_controller->cleanLeases();
     if ($cleaner) {
         $this->info($cleaner);
     }
 }
開發者ID:magnusboman,項目名稱:concierge,代碼行數:14,代碼來源:leasemanager.php

示例5: showFellowSelect

 public function showFellowSelect($city_id)
 {
     $fellowName = "Propel Fellow";
     $home = new HomeController();
     $year = $home->get_year();
     $fellows = Group::where('name', '=', $fellowName)->first()->fellow()->distinct()->where('city_id', '=', $city_id)->where('year', '=', $year)->where('status', '=', '1')->where('user_type', '=', 'volunteer')->get();
     //return $fellows;
     return View::make('city.select-fellow')->with('fellows', $fellows);
 }
開發者ID:makeadiff,項目名稱:propel,代碼行數:9,代碼來源:CityChangeController.php

示例6: foundController

 public function foundController()
 {
     if ($this->url == "home") {
         $controller = new HomeController();
         $controller->index();
     } elseif ($this->url == "conversor") {
         $controller = new ConversorController();
         $controller->index();
     }
 }
開發者ID:NicolasMontoya,項目名稱:portafolio,代碼行數:10,代碼來源:FrontController.php

示例7: GET

 function GET($matches)
 {
     $home = new HomeController($matches);
     if (array_key_exists(1, $matches)) {
         if ($matches[1] == "json") {
             $home->renderJson();
         }
     } else {
         $home->render();
     }
 }
開發者ID:desurus,項目名稱:tradesy-home-test,代碼行數:11,代碼來源:index.php

示例8: HomeAction

 public static function HomeAction()
 {
     if (!isset($_SESSION["usuarioActual"])) {
         HomeController::LoginAction();
         return;
     }
     require_once './views/Home/index.php';
 }
開發者ID:Rabp9,項目名稱:sirall2,代碼行數:8,代碼來源:HomeController.php

示例9: perguntasSemelhantes

 public function perguntasSemelhantes($texto)
 {
     $perguntas = DB::table('perguntas')->orderBy('data_hora', 'desc')->get();
     $arRetorno = array();
     foreach ($perguntas as $pergunta) {
         if (HomeController::cosineSimilarity($texto, $pergunta->pergunta)) {
             array_push($arRetorno, $pergunta);
         }
     }
     return Response::json($arRetorno);
 }
開發者ID:edgareler,項目名稱:qsabe-remake,代碼行數:11,代碼來源:HomeController.php

示例10: __construct

 /**
  * "Start" the application:
  * Analyze the URL elements and calls the according controller/method or the fallback
  */
 public function __construct()
 {
     // create array with URL parts in $url
     $this->splitUrl();
     // check for controller: no controller given ? then load start-page
     if (!$this->url_controller) {
         require APP . 'controller/home.php';
         $page = new HomeController();
         $page->index();
     } elseif (file_exists(APP . 'controller/' . $this->url_controller . '.php')) {
         // here we did check for controller: does such a controller exist ?
         // if so, then load this file and create this controller
         // example: if controller would be "car", then this line would translate into: $this->car = new car();
         require APP . 'controller/' . $this->url_controller . '.php';
         $controller = ucfirst($this->url_controller) . 'Controller';
         $this->url_controller = new $controller();
         // check for method: does such a method exist in the controller ?
         if (method_exists($this->url_controller, $this->url_action)) {
             if (!empty($this->url_params)) {
                 // Call the method and pass arguments to it
                 call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
             } else {
                 // If no parameters are given, just call the method without parameters, like $this->home->method();
                 $this->url_controller->{$this->url_action}();
             }
         } else {
             if (strlen($this->url_action) == 0) {
                 // no action defined: call the default index() method of a selected controller
                 $this->url_controller->index();
             } else {
                 header('location: ' . URL . 'error');
             }
         }
     } else {
         header('location: ' . URL . 'error');
     }
 }
開發者ID:Technology-Across-the-Curriculum,項目名稱:WordSalad-Service,代碼行數:41,代碼來源:application.php

示例11: _initialize

 public function _initialize()
 {
     parent::_initialize();
     $this->assign('check_all', false);
     $this->assign('search_url', U('lists'));
     define('ADDON_PUBLIC_PATH', '');
     defined('_ADDONS') or define('_ADDONS', MODULE_NAME);
     defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME);
     defined('_ACTION') or define('_ACTION', ACTION_NAME);
     $this->model = M('model')->getByName('public');
     $this->assign('model', $this->model);
     // dump ( $this->model );
     $res['title'] = $this->model['title'];
     $res['url'] = U('lists');
     $res['class'] = ACTION_NAME != 'help' ? 'current' : '';
     $nav[] = $res;
     // $res ['title'] = '管理員配置';
     // $res ['url'] = U ( 'Home/Admin/lists' );
     // $res ['class'] = '';
     // $nav [] = $res;
     if (ACTION_NAME == 'help') {
         $res['title'] = '接口配置幫助';
         $res['url'] = U('help', array('public_id' => $_GET['public_id']));
         $res['class'] = 'current';
         $nav[] = $res;
     }
     $this->assign('nav', $nav);
 }
開發者ID:chenpusn,項目名稱:guoxian,代碼行數:28,代碼來源:PublicController.class.php

示例12: getInstance

 public static function getInstance($params = array())
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self($params);
     }
     return self::$instance;
 }
開發者ID:VecHK,項目名稱:pache,代碼行數:7,代碼來源:index.php

示例13: display

 /**
  * 模板顯示 調用內置的模板引擎顯示方法,
  * @access protected
  * @param string $templateFile 指定要調用的模板文件
  * @return void
  */
 protected function display($template)
 {
     $file = T('Addons://' . parse_name($_GET['_addons'], 1) . '@./' . ucfirst($_GET['_controller']) . '/' . $_GET['_action']);
     define('IS_ADDON', true);
     parent::display($file);
     // 重要:要避免陷入$this->display()循環
 }
開發者ID:applemin,項目名稱:tangguo,代碼行數:13,代碼來源:AddonController.class.php

示例14:

 function __construct()
 {
     parent::__construct();
     $this->uid = is_login();
     if (!$this->uid) {
         $this->redirect('User/login');
     }
 }
開發者ID:rainly123,項目名稱:zyzm,代碼行數:8,代碼來源:ManageController.class.php

示例15: _initialize

 public function _initialize()
 {
     parent::_initialize();
     $this->Notice = M('notice');
     $this->Ndetail = M('noticeDetail');
     $this->Youpin = M('youpin');
     $this->Ydetail = M('youpinDetail');
 }
開發者ID:xiaolw,項目名稱:wacms,代碼行數:8,代碼來源:MusicController.class.php


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