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


PHP loadController函數代碼示例

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


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

示例1: execAction

function execAction($route)
{
    $ctrl = loadController($route);
    $act = "action" . ucfirst($route['act']);
    if (method_exists($ctrl, $act)) {
        $ctrl->{$act}();
    } else {
        die("頁麵不存在!");
    }
}
開發者ID:lvchenbaby,項目名稱:convey,代碼行數:10,代碼來源:functions.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     if (!bt_cloaker_enabled()) {
         echo 0;
         BTApp::end();
     }
     $this->loadModel('CloakerModel');
     $this->loadModel('CloakerOptionModel');
     $this->loadModel('CampaignModel');
     $this->loadModel("ClickAdvancedModel");
     require_once BT_ROOT . '/private/includes/cloaker.php';
     loadController("TrackerController");
 }
開發者ID:sakibanda,項目名稱:ballistic-tracking,代碼行數:14,代碼來源:ApiController.php

示例3: run

function run()
{
    try {
        if (!isset($_GET["controller"])) {
            $_GET["controller"] = DEFAULT_CONTROLLER;
        }
        if (!isset($_GET["action"])) {
            $_GET["action"] = DEFAULT_ACTION;
        }
        $controller = loadController($_GET["controller"]);
        $actionName = $_GET["action"];
        $controller->{$actionName}();
    } catch (Exception $ex) {
        die("An exception occured!!!!!" . $ex->getMessage());
    }
}
開發者ID:agonbar,項目名稱:pinchOS,代碼行數:16,代碼來源:index.php

示例4: __construct

 /**
  * Class constructor.
  *
  * @param string $method
  * @param array $messages
  * @return unknown
  */
 function __construct($method, $messages)
 {
     parent::__construct();
     static $__previousError = null;
     $allow = array('.', '/', '_', ' ', '-', '~');
     if (substr(PHP_OS, 0, 3) == "WIN") {
         $allow = array_merge($allow, array('\\', ':'));
     }
     $clean = new Sanitize();
     $messages = $clean->paranoid($messages, $allow);
     if (!class_exists('Dispatcher')) {
         require CAKE . 'dispatcher.php';
     }
     $this->__dispatch =& new Dispatcher();
     if ($__previousError != array($method, $messages)) {
         $__previousError = array($method, $messages);
         if (!class_exists('AppController')) {
             loadController(null);
         }
         $this->controller =& new AppController();
         if (!empty($this->controller->uses)) {
             $this->controller->constructClasses();
         }
         $this->controller->_initComponents();
         $this->controller->cacheAction = false;
         $this->__dispatch->start($this->controller);
         if (method_exists($this->controller, 'apperror')) {
             return $this->controller->appError($method, $messages);
         }
     } else {
         $this->controller =& new Controller();
         $this->controller->cacheAction = false;
     }
     if (Configure::read() > 0 || $method == 'error') {
         call_user_func_array(array(&$this, $method), $messages);
     } else {
         call_user_func_array(array(&$this, 'error404'), $messages);
     }
 }
開發者ID:hilkeros,項目名稱:MMM-php-cake,代碼行數:46,代碼來源:error.php

示例5: run

/**
 * Main router (single entry-point for all requests)
 * of the MVC implementation.
 * 
 * This router will create an instance of the corresponding
 * controller, based on the "controller" parameter and call
 * the corresponding method, based on the "action" parameter.
 * 
 * The rest of GET or POST parameters should be handled by
 * the controller itself.
 * 
 * Parameters:
 * <ul>
 * <li>controller: The controller name (via HTTP GET)
 * <li>action: The name inside the controller (via HTTP GET)
 * </ul>
 * 
 * @return void
 * 
 * @author lipido <lipido@gmail.com>
 */
function run()
{
    // invoke action!
    try {
        if (!isset($_GET["controller"])) {
            $_GET["controller"] = DEFAULT_CONTROLLER;
        }
        if (!isset($_GET["action"])) {
            $_GET["action"] = DEFAULT_ACTION;
        }
        // Here is where the "magic" occurs.
        // URLs like: index.php?controller=posts&action=add
        // will provoke a call to: new PostsController()->add()
        // Instantiate the corresponding controller
        $controller = loadController($_GET["controller"]);
        // Call the corresponding action
        $actionName = $_GET["action"];
        $controller->{$actionName}();
    } catch (Exception $ex) {
        //uniform treatment of exceptions
        die("An exception occured!!!!!" . $ex->getMessage());
    }
}
開發者ID:adri229,項目名稱:TSW_Proyect,代碼行數:44,代碼來源:index.php

示例6: loadController

 /**
  * load Controller
  *
  * @param string  $name
  */
 function loadController($name)
 {
     if (class_exists('App')) {
         App::import('Controller', $name);
     } else {
         loadController($name);
     }
 }
開發者ID:xxxmasaxxx,項目名稱:cakeinfo,代碼行數:13,代碼來源:cakeinfo.php

示例7: loadController

<?php

loadController('AdminController');
class AdminAccountsController extends AdminController
{
    public function indexAction()
    {
        $this->setVar("title", "Manage Accounts");
        $this->render("admin/accounts");
    }
    public function ajaxAction($command = '', $params = array())
    {
        switch ($command) {
            case 'view_accountlist':
                $userlist = UserModel::model()->getRows();
                $this->setVar("userlist", $userlist);
                $this->loadView("admin/accounts_list");
                break;
            case 'json_user':
                $user = UserModel::model()->getRowFromPk($_GET['user_id']);
                echo $user->toJSON();
                break;
            case 'post_delete':
                $user_id = $_POST['user_id'];
                $user = UserModel::model()->getRowFromPk($user_id);
                $user->delete();
                break;
            case 'post_add':
                $user = UserModel::model();
                $user->user_name = $_POST['user_name'];
                $user->email = $_POST['email'];
開發者ID:sakibanda,項目名稱:ballistic-tracking,代碼行數:31,代碼來源:AdminAccountsController.php

示例8: loadController

<?php

loadController('OrderStatuses');
class OrderStatusesControllerTestCase extends CakeTestCase
{
    var $TestObject = null;
    function setUp()
    {
        $this->TestObject = new OrderStatusesController();
    }
    function tearDown()
    {
        unset($this->TestObject);
    }
}
開發者ID:feiyue2008,項目名稱:phpshop,代碼行數:15,代碼來源:orderStatuses_controller.test.php

示例9: loadController

<?php

loadController('Galleries');
class GalleriesControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new GalleriesController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
開發者ID:paulToro,項目名稱:webrocket,代碼行數:15,代碼來源:galleries_controller.test.php

示例10: loadController

<?php

//Load the base controller
require_once 'core/BaseController.php';
//Load extra functions to front
require_once 'core/controller.extra.php';
//Load the controllers
if (isset($_GET["controller"])) {
    $controllerObj = loadController($_GET["controller"]);
    runAction($controllerObj);
} else {
    $controllerObj = loadController('Home');
    runAction($controllerObj);
}
開發者ID:Magicvan,項目名稱:simple_mvc,代碼行數:14,代碼來源:index.php

示例11: loadController

<?php

loadController('Countries');
class CountriesControllerTestCase extends CakeTestCase
{
    var $TestObject = null;
    function setUp()
    {
        $this->TestObject = new CountriesController();
    }
    function tearDown()
    {
        unset($this->TestObject);
    }
}
開發者ID:feiyue2008,項目名稱:phpshop,代碼行數:15,代碼來源:countries_controller.test.php

示例12: explode

include_once S_ROOT . './source/function_user.php';
include_once S_ROOT . './models/mysqlDBA.php';
//時間
$mtime = explode(' ', microtime());
$_SGLOBAL['timestamp'] = $mtime[1];
$_SGLOBAL['supe_starttime'] = $_SGLOBAL['timestamp'] + $mtime[0];
if (defined('SHOW_PAGE_TIME')) {
    //頁麵速度測試
    $mtime = explode(' ', microtime());
    $sqlstarttime = number_format($mtime[1] + $mtime[0] - $_SGLOBAL['supe_starttime'], 6) * 1000;
}
//初始化
$_SGLOBAL['query_string'] = $_SERVER['QUERY_STRING'];
$_SGLOBAL['inajax'] = empty($_GET['inajax']) ? 0 : intval($_GET['inajax']);
$_SGLOBAL['mobile'] = empty($_GET['mobile']) ? 0 : trim($_GET['mobile']);
$_SGLOBAL['refer'] = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
require_once S_ROOT . "./config/global.conf.php";
//全局數組
if (file_exists(S_ROOT . "./config/app/" . APP . ".conf.php")) {
    require_once S_ROOT . "./config/app/" . APP . ".conf.php";
    //APP全局數組
}
if (REWRITE_URL) {
    $_NGET = parseRewriteQueryString($_SGLOBAL['query_string']);
    !empty($_NGET['controller']) && ($_GET = $_NGET);
    $_SGLOBAL['query_string'] = _queryString($_SGLOBAL['query_string']);
}
dbconnect(APP);
//連接數據庫
loadController($arrController, APP);
$_SGLOBAL['memory'] = memory_get_usage();
開發者ID:nymbian,項目名稱:codelib,代碼行數:31,代碼來源:common.php

示例13: __loadDependencies

 /**
  * Load dependencies for given element (controller/component/helper)
  *
  * @param string $element Element to load dependency for
  * @access private
  */
 function __loadDependencies($element)
 {
     switch (low($element)) {
         case 'behavior':
             loadModel(null);
             loadBehavior(null);
             break;
         case 'controller':
             loadController(null);
             break;
         case 'component':
             loadComponent(null);
             break;
         case 'helper':
             uses('view' . DS . 'helper');
             loadHelper(null);
             break;
         case 'model':
             loadModel(null);
             break;
     }
 }
開發者ID:rhencke,項目名稱:mozilla-cvs-history,代碼行數:28,代碼來源:api.php

示例14: loadController

<?php

loadController('CustomerGroups');
class CustomerGroupsControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new CustomerGroupsController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
開發者ID:feiyue2008,項目名稱:phpshop,代碼行數:15,代碼來源:customerGroups_controller.test.php

示例15: loadController

<?php

loadController('categorias');
class categoriasControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new categoriasController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
開發者ID:prigobel,項目名稱:erp-cakephp,代碼行數:15,代碼來源:categorias_controller.test.php


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