本文整理匯總了PHP中DefaultController::index方法的典型用法代碼示例。如果您正苦於以下問題:PHP DefaultController::index方法的具體用法?PHP DefaultController::index怎麽用?PHP DefaultController::index使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DefaultController
的用法示例。
在下文中一共展示了DefaultController::index方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
$this->splitUrl();
if (!$this->url_controller) {
require APP . 'controller/DefaultController.php';
$page = new DefaultController();
$page->index();
} elseif (file_exists(APP . 'controller/' . ucfirst($this->url_controller) . 'Controller.php')) {
$this->url_controller = ucfirst($this->url_controller) . 'Controller';
require APP . 'controller/' . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
$this->url_controller->index();
} else {
header('location: ' . URL . 'error');
}
}
} else {
header('location: ' . URL . 'error');
}
}
示例2: index
<?php
class DefaultController extends adapterUi
{
function index()
{
$tplDir = $this->cmsdata['head']['tplDir'];
header("Content-type:text/html;charset=UTF-8");
if (!empty($this->cmsdata['head']['forceCompile'])) {
$smarty->force_compile = true;
}
$this->smarty->display($tplDir);
}
}
$controller = new DefaultController();
$controller->index();
/*$sysData['templateRoot'] = $smarty->getTemplateDir(0)."/";
if(isset($_GET['debug'])){
if($_GET['debug'] == 'on'){
$smarty->debugging = true;
}
}*/
/*if( !empty( $rootData['head']['forceCompile'] ) ){
$smarty->force_compile = true;
}
$smarty->assign('root',$rootData);
$smarty->assign('sysInfo',$sysData);
$smarty->display($tplDir);*/
示例3: check_logged_in
<?php
function check_logged_in()
{
BaseController::check_logged_in();
}
function check_if_admin()
{
BaseController::check_if_admin();
}
$routes->get('/', function () {
DefaultController::index();
});
$routes->get('/info', function () {
DefaultController::info();
});
$routes->post('/ostoskori/:id/lisaa', function ($id) {
CartController::add($id);
});
$routes->post('/ostoskori/:id/poista', function ($id) {
CartController::delete($id);
});
$routes->post('/ostoskori/tyhjenna', function () {
CartController::deleteAll();
});
$routes->get('/kassa', function () {
OrdersController::add_form();
});
$routes->post('/kassa', function () {
OrdersController::add();
});