本文整理汇总了PHP中App::getRouter方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getRouter方法的具体用法?PHP App::getRouter怎么用?PHP App::getRouter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App::getRouter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restore
public function restore()
{
$params = App::getRouter()->getParams();
if (strlen($params[0]) > 0) {
$res = $this->model->getRestorePass($params[0]);
if ($params[0] == $res[0]['hash']) {
// если хеш в базе найден - показать страницу с восстановлением и грохнуть записи из таблицы хеша
$this->model->delRestorePass($res[0]['email'], $res[0]['hash']);
// тут удалим из базы мыло и хеш логина при подтверждении
$data = $res[0]['id_user'];
$this->data['restore'] = $data;
}
} else {
// проверим ответ
if (count($_POST)) {
if (!is_null($_POST['password']) && !is_null($_POST['password1']) && $_POST['password'] == $_POST['password1']) {
// и если все получено ок
$data = $_POST;
$this->model->saveNewPass($data);
// записать новый пароль
Router::redirect('/');
}
}
}
}
示例2: view
public function view()
{
$params = App::getRouter()->getParams();
if (isset($params[0])) {
$name = strtolower($params[0]);
$this->data['project'] = $this->model->getByKoDescription($name);
}
}
示例3: __construct
function __construct($data = array())
{
$this->data = $data;
$this->params = App::getRouter()->getParams();
$this->params_get = App::getRouter()->getParamsGet();
// adding global value accounts count to all controllers
$this->data['account_count'] = (new Person())->getAccountCount();
}
示例4: view
public function view()
{
$params = App::getRouter()->getParams();
if (isset($params[0])) {
$id = strtolower($params[0]);
$this->data['product'] = $this->model->getById($id);
}
}
示例5: admin_delete
public function admin_delete()
{
$params = App::getRouter()->getParams();
if (isset($params[0])) {
$this->model->eventDelete($params[0]);
Router::redirect('/admin/events');
}
}
示例6: view
public function view()
{
$params = App::getRouter()->getParams();
if (isset($params[0])) {
$alias = strtolower($params[0]);
$this->data['content'] = "Here will be a page with '{$alias}' alias";
}
}
示例7: viev
public function viev()
{
$params = App::getRouter()->getParams();
if (isset($params[0])) {
$alias = strtolower($params[0]);
echo "Here will be a page with '{$alias}' alias";
}
}
示例8: view
public function view()
{
$params = App::getRouter()->getParams();
if (isset($params[0])) {
$alias = strtolower($params[0]);
$this->data['page'] = $this->model->getByAlias($alias);
}
}
示例9: admin_index
public function admin_index()
{
if (Session::get('role') != 'admin') {
Router::redirect('/');
}
$params = App::getRouter()->getParams();
print_r($params);
$this->data['pages'] = $this->model->getList($params[0]);
}
示例10: view
public function view()
{
$params = App::getRouter()->getParams();
if (isset($params[0])) {
$alias = strtolower($params[0]);
$this->data['page'] = $this->model->getByAlias($alias);
}
$comments_model = new Comment();
$this->data['comments'] = $comments_model->getByPageId($this->data['page']['id']);
}
示例11: getDefaultViewPath
protected static function getDefaultViewPath()
{
$router = App::getRouter();
if (!$router) {
throw new Exception('Router was not found');
}
$controller_dir = $router->getController();
$template_name = $router->getMethodPrefix() . $router->getAction() . '.php';
return VIEWS_PATH . DS . $controller_dir . DS . $template_name;
}
示例12: getDefaultViewPath
protected static function getDefaultViewPath()
{
$router = App::getRouter();
if (!$router) {
return false;
}
$controller_dir = $router->getController();
$template_name = $router->getMethodPrefix() . $router->getAction() . '.html';
return VIEWS_PATH . DS . $controller_dir . DS . $template_name;
}
示例13: view
public function view()
{
$params = App::getRouter()->getParams();
$this->data['excInfo'] = $this->model->getExcursionById($params[0]);
if (isset($params[0]) && isset($this->data['excInfo'])) {
$this->data['userInfo'] = $this->model->getUserInfo($this->data['excInfo']['user_id']);
} else {
Router::redirect('/');
}
}
示例14: __construct
public function __construct($data = array())
{
//session_start();
if (isset($_SESSION['time']) && time() - $_SESSION['time'] > 3600) {
session_destroy();
Router::redirect('/');
// session_start();
}
$_SESSION['time'] = time();
$this->data = $data;
$this->params = App::getRouter()->getParams();
}
示例15: add
public function add()
{
$params = App::getRouter()->getParams();
if (isset($params[0])) {
$result = $this->model->add($_POST, $params[0]);
if ($result) {
Session::MessageSend(3, 'Ваш отзыв добавлен успешно.', '/users/reviews/' . $params[0]);
} else {
Session::MessageSend(1, 'Что-то пошлно не так, возможно вы не заполнили все поля.', '/users/reviews/' . $params[0]);
}
}
}