当前位置: 首页>>代码示例>>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;未经允许,请勿转载。