本文整理汇总了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("页面不存在!");
}
}
示例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");
}
示例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());
}
}
示例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);
}
}
示例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());
}
}
示例6: loadController
/**
* load Controller
*
* @param string $name
*/
function loadController($name)
{
if (class_exists('App')) {
App::import('Controller', $name);
} else {
loadController($name);
}
}
示例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'];
示例8: loadController
<?php
loadController('OrderStatuses');
class OrderStatusesControllerTestCase extends CakeTestCase
{
var $TestObject = null;
function setUp()
{
$this->TestObject = new OrderStatusesController();
}
function tearDown()
{
unset($this->TestObject);
}
}
示例9: loadController
<?php
loadController('Galleries');
class GalleriesControllerTestCase extends UnitTestCase
{
var $object = null;
function setUp()
{
$this->object = new GalleriesController();
}
function tearDown()
{
unset($this->object);
}
}
示例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);
}
示例11: loadController
<?php
loadController('Countries');
class CountriesControllerTestCase extends CakeTestCase
{
var $TestObject = null;
function setUp()
{
$this->TestObject = new CountriesController();
}
function tearDown()
{
unset($this->TestObject);
}
}
示例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();
示例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;
}
}
示例14: loadController
<?php
loadController('CustomerGroups');
class CustomerGroupsControllerTestCase extends UnitTestCase
{
var $object = null;
function setUp()
{
$this->object = new CustomerGroupsController();
}
function tearDown()
{
unset($this->object);
}
}
示例15: loadController
<?php
loadController('categorias');
class categoriasControllerTestCase extends UnitTestCase
{
var $object = null;
function setUp()
{
$this->object = new categoriasController();
}
function tearDown()
{
unset($this->object);
}
}