当前位置: 首页>>代码示例>>PHP>>正文


PHP HomeController::index方法代码示例

本文整理汇总了PHP中HomeController::index方法的典型用法代码示例。如果您正苦于以下问题:PHP HomeController::index方法的具体用法?PHP HomeController::index怎么用?PHP HomeController::index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HomeController的用法示例。


在下文中一共展示了HomeController::index方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: logout

 public function logout()
 {
     session_start();
     session_unset();
     $home = new HomeController();
     return $home->index();
 }
开发者ID:navi15486,项目名称:MusicMVC,代码行数:7,代码来源:loginController.php

示例2: isset

 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

示例3: 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

示例4: __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

示例5: publishOne

 function publishOne($contentId, $blockId)
 {
     include "config/site.php";
     $model = new BaseModel();
     $home = new HomeController();
     //first create news.html
     $news_file_name = "static/" . $tpl_name . "_news.html";
     ob_start();
     $home->news();
     $news_contents = ob_get_contents();
     ob_end_clean();
     $fp = fopen($news_file_name, "w");
     fwrite($fp, $news_contents);
     fclose($fp);
     //$logger = LogUtil::getLogger();
     //create a static html for this article
     $fname = "static/" . $tpl_name . "/" . $contentId . ".html";
     //$logger->info($fname);
     ob_start();
     $_GET["id"] = $contentId;
     $contestIdListStr .= $contentId . ",";
     $home->info();
     $content = ob_get_contents();
     ob_end_clean();
     $fp = fopen($fname, "w");
     fwrite($fp, $content);
     fclose($fp);
     //$logger->info("finished");
     //create a static html for this article's block
     $fname = "static/" . $tpl_name . "/b" . $blockId . ".html";
     $_GET['block_id'] = $blockId;
     ob_start();
     $home->index();
     //php after render ,all mysql connections will be reset
     $indexContent = ob_get_contents();
     ob_end_clean();
     $fp = fopen($fname, "w");
     fwrite($fp, $indexContent);
     fclose($fp);
     //$contentObj = new Content();
     //$contentObj->updatePublishSts($contestIdListStr);
     //create index.html
     unset($_GET['block_id']);
     ob_start();
     $home->index();
     //php after render all mysql connections will be reset
     $indexContent = ob_get_contents();
     ob_end_clean();
     $fp = fopen("index.html", "w");
     fwrite($fp, $indexContent);
     fclose($fp);
     //echo "true";
 }
开发者ID:puregamexyz,项目名称:bitdesign.github.io,代码行数:53,代码来源:AdminController.php

示例6: function

<?php

$routes->get('/', function () {
    HomeController::index();
});
// Auth
$routes->get('/login', 'guest', function () {
    AuthController::login();
});
$routes->post('/login', 'guest', function () {
    AuthController::handle_login();
});
$routes->get('/logout', 'auth', function () {
    AuthController::logout();
});
// Profile
$routes->get('/profile/edit', 'auth', function () {
    ProfileController::edit();
});
$routes->post('/profile/update', 'auth', function () {
    ProfileController::edit();
});
$routes->get('/profile/password', 'auth', function () {
    ProfileController::password();
});
$routes->post('/profile/password/update', 'auth', function () {
    ProfileController::updatePassword();
});
// Controlpanel
$routes->get('/controlpanel', 'admin', function () {
    AuthController::controlpanel();
开发者ID:KristianLauttamus,项目名称:HospitalSchedule,代码行数:31,代码来源:routes.php

示例7: Slim

<?php

$app = new Slim();
// The following routes are accessed directly via browser
$app->get('/', function () {
    UserHelper::requireProfile();
    $controller = new HomeController();
    $controller->index();
});
$app->get('/passwd', function () {
    UserHelper::requireProfile();
    $controller = new LoginController();
    $controller->passwd();
});
$app->get('/login2', function () {
    //UserHelper::requireProfile();
    $controller = new LoginController();
    $controller->login();
});
$app->get('/inbox', function () {
    UserHelper::requireProfile();
    $controller = new MailController();
    $controller->inbox();
});
$app->get('/inbox/:id', function ($id) {
    UserHelper::requireProfile();
    $controller = new MailController();
    $controller->inbox($id);
});
$app->get('/help', function () {
    //UserHelper::requireProfile();
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:31,代码来源:routes.php

示例8: init

 /**
  * Aca tenemos que definir todas las rutas que la aplicación va a aceptar.
  */
 public static function init()
 {
     // Esta seria la pagina de incio
     if ($_SERVER['REQUEST_URI'] == '/electiva_php_ude_2015/') {
         $controller = new HomeController();
         $controller->index();
     } else {
         if (strpos($_SERVER['REQUEST_URI'], 'sessions')) {
             $controller = new SessionsController();
             if (strpos($_SERVER['REQUEST_URI'], 'login') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                 $controller->modal();
             } else {
                 if (strpos($_SERVER['REQUEST_URI'], 'login') && $_SERVER['REQUEST_METHOD'] == 'POST') {
                     $controller->login();
                 } else {
                     if (strpos($_SERVER['REQUEST_URI'], 'logout') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                         $controller->logout();
                     } else {
                         if ($_SERVER['REQUEST_METHOD'] == 'GET') {
                             $controller->index();
                         }
                     }
                 }
             }
         } else {
             if (strpos($_SERVER['REQUEST_URI'], 'users')) {
                 $controller = new UsersController();
                 if (strpos($_SERVER['REQUEST_URI'], 'create') && $_SERVER['REQUEST_METHOD'] == 'POST') {
                     $controller->create();
                 } else {
                     if (strpos($_SERVER['REQUEST_URI'], 'new') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                         $controller->form();
                     } else {
                         if (strpos($_SERVER['REQUEST_URI'], 'delete') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                             $controller->delete();
                         } else {
                             if (strpos($_SERVER['REQUEST_URI'], 'modify') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                                 $controller->modify();
                             } else {
                                 if (strpos($_SERVER['REQUEST_URI'], 'update') && $_SERVER['REQUEST_METHOD'] == 'POST') {
                                     $controller->update();
                                 } else {
                                     if ($_SERVER['REQUEST_METHOD'] == 'GET') {
                                         $controller->index();
                                     }
                                 }
                             }
                         }
                     }
                 }
             } else {
                 if (strpos($_SERVER['REQUEST_URI'], 'polyclinics')) {
                     $controller = new PolyclinicsController();
                     if (strpos($_SERVER['REQUEST_URI'], 'create') && $_SERVER['REQUEST_METHOD'] == 'POST') {
                         $controller->create();
                     } else {
                         if (strpos($_SERVER['REQUEST_URI'], 'new') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                             $controller->form();
                         } else {
                             if (strpos($_SERVER['REQUEST_URI'], 'delete') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                                 $controller->delete();
                             } else {
                                 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
                                     $controller->index();
                                 }
                             }
                         }
                     }
                 } else {
                     if (strpos($_SERVER['REQUEST_URI'], 'reports')) {
                         $controller = new ReportsController();
                         if (strpos($_SERVER['REQUEST_URI'], 'index') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                             $controller->index();
                         } else {
                             if ($_SERVER['REQUEST_METHOD'] == 'GET') {
                                 $controller->index();
                             }
                         }
                     } else {
                         if (strpos($_SERVER['REQUEST_URI'], 'bookings')) {
                             $controller = new BookingsController();
                             if (strpos($_SERVER['REQUEST_URI'], 'create') && $_SERVER['REQUEST_METHOD'] == 'POST') {
                                 $controller->create();
                             } else {
                                 if (strpos($_SERVER['REQUEST_URI'], 'new') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                                     $controller->form();
                                 } else {
                                     if (strpos($_SERVER['REQUEST_URI'], 'delete') && $_SERVER['REQUEST_METHOD'] == 'GET') {
                                         $controller->delete();
                                     } else {
                                         if ($_SERVER['REQUEST_METHOD'] == 'GET') {
                                             $controller->index();
                                         }
                                     }
                                 }
                             }
                         } else {
//.........这里部分代码省略.........
开发者ID:santiagodoldan,项目名称:electiva_php_ude_2015,代码行数:101,代码来源:routes.php

示例9: index

<?php

abstract class Controller
{
    public $data;
    function assign($key, $value)
    {
        return $this->data[$key] = $value;
    }
    function display($file = '')
    {
        extract($this->data);
        if (empty($file)) {
            $file = "./test.php";
        }
        include $file;
    }
}
class HomeController extends Controller
{
    public function index()
    {
        $arr = array('age' => '12', 'high' => '170cm');
        $this->assign('info', $arr);
        $this->display();
    }
}
$home = new HomeController();
$home->index();
开发者ID:lisiqiong,项目名称:DesignPatterns,代码行数:29,代码来源:index.php


注:本文中的HomeController::index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。