[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: MVC php + ajax
Страницы: 1, 2, 3
Guest
Еще раз:
по /lottery должна открываться веб-страница.
по /lottery/selectall/ json.

Убедись что бы было так.
Guest
У тебя наверное еще есть Controller_index да? Который собственно веб-страницу и возвращает?
Если да – то Action_index в Controller_lottery не нужна.
maruo
Guest
Да именно так 1 я ссылка веб страница
2я чисто json текст но не так как вы написали, а именно мой вариант!
maruo
Цитата (Guest @ 31.03.2016 - 20:14)
У тебя наверное еще есть Controller_index да? Который собственно веб-страницу и возвращает?
Если да – то Action_index в Controller_lottery не нужна.

Без Controller_lottery ошибки будут.
Fatal error: Call to undefined method Controller_lottery::Action_index() in C:\OpenServer\domains\E-Sport.market\system\core\router.php on line 33

Controller_index отвечает за index страницу
Guest
Цитата
Если да – то Action_index в Controller_lottery не нужна.


Не Controller_lottery не нужен, а Action_index не нужен.
maruo
Guest
Ну я ж говорю без него выдаст ошибку в роутере,


class Router{

public static function Start(){
//Параметры по умолчанию
$controller_name = 'index';
$action_name = 'index';
$action_parameters = array();

$route_array = explode('/', $_SERVER['REQUEST_URI'],3);
if (!empty($route_array[1])) {
$controller_name = $route_array[1];
}
if (!empty($route_array[2])) {
$action_name = $route_array[2];
}

$model_name = 'Model_'.$controller_name;
$controller_name = 'Controller_'.$controller_name;
$action_name = 'Action_'.$action_name;

if(file_exists(F_PATCH.'/system/model/'.$model_name.'.php')){
include F_PATCH.'/system/model/'.$model_name.'.php';
}
if(file_exists(F_PATCH.'/system/controller/'.$controller_name.'.php')){
include F_PATCH.'/system/controller/'.$controller_name.'.php';
}else{
header("Location: /404");
}

$controller = new $controller_name();
$controller->$action_name();


}
}
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.