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