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


PHP DefaultController::run方法代碼示例

本文整理匯總了PHP中DefaultController::run方法的典型用法代碼示例。如果您正苦於以下問題:PHP DefaultController::run方法的具體用法?PHP DefaultController::run怎麽用?PHP DefaultController::run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DefaultController的用法示例。


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

示例1: isset

<?php

/**
 * Copyright (c) 2014 Keith Casey
 *
 * This code is designed to accompany the lynda.com video course "Design Patterns in PHP"
 *   by Keith Casey. If you've received this code without seeing the videos, go watch the
 *   videos. It will make way more sense and be more useful in general.
 */
include_once 'controllers/default_controller.php';
include_once 'controllers/number_controller.php';
include_once 'models/number_model.php';
$action = isset($_GET['a']) ? $_GET['a'] : 'index';
$module = isset($_GET['m']) ? $_GET['m'] : '';
$id = isset($_GET['id']) ? $_GET['id'] : '';
switch ($module) {
    case 'number':
        $controller = new NumberController();
        break;
    default:
        $controller = new DefaultController();
}
$controller->run($action, $id);
開發者ID:raynaldmo,項目名稱:php-education,代碼行數:23,代碼來源:index.php

示例2: function

<?php

/**
 * Copyright (c) 2014 Keith Casey.
 *
 * This code is designed to accompany the lynda.com video course "Design Patterns in PHP"
 *   by Keith Casey. If you've received this code without seeing the videos, go watch the
 *   videos. It will make way more sense and be more useful in general.
 */
require 'vendor/autoload.php';
include_once 'controllers/default_controller.php';
include_once 'controllers/number_controller.php';
include_once 'models/number_model.php';
$app = new \Slim\Slim();
$app->get('/', function () {
    include 'views/default.php';
});
$app->get('/:module(/:number)', function ($module, $number = 1) {
    switch ($module) {
        case 'number':
            $controller = new NumberController();
            break;
        default:
            $controller = new DefaultController();
    }
    $action = 'view';
    $controller->run($action, $number);
});
$app->run();
開發者ID:matteo-hertel,項目名稱:archive,代碼行數:29,代碼來源:index.php

示例3: isset

<?php

/**
 * Copyright (c) 2014 Keith Casey
 *
 * This code is designed to accompany the lynda.com video course "Design Patterns in PHP"
 *   by Keith Casey. If you've received this code without seeing the videos, go watch the
 *   videos. It will make way more sense and be more useful in general.
 */
include_once 'controllers/default_controller.php';
include_once 'controllers/greeting_controller.php';
include_once 'models/greeting.php';
$action = isset($_GET['a']) ? $_GET['a'] : 'index';
$module = isset($_GET['m']) ? $_GET['m'] : '';
switch ($module) {
    case 'greeting':
        $controller = new GreetingController();
        break;
    default:
        $controller = new DefaultController();
}
$controller->run($action);
開發者ID:raynaldmo,項目名稱:php-education,代碼行數:22,代碼來源:index.php


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