Ejemplo n.º 1
0
 public function match($base = '/')
 {
     $request = new Request();
     //    var_dump('Route base--', $base);
     //    var_dump('request', $request->requestURL());
     //    var_dump('match', $base . $this->path);
     $path = $base . $this->path;
     // takeout extra slash
     $path = str_replace('//', '/', $path);
     if (strtolower($request->requestURL()) == strtolower($path) && strtolower($request->method()) == strtolower($this->method)) {
         // Resolve dependency
         $page = $this->resolver->resolveCallback($this->callback, [$this->routeParam]);
         echo $page;
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 public function AddPage(Request $request)
 {
     $result = $this->model->add($request->param('content'), $request->param('name'), $request->param('link'));
     return $this->view->json(['success' => $result, 'id' => $this->model->getLastId()]);
 }
Ejemplo n.º 3
0
 public function SaveMenu(Request $request)
 {
     $result = $this->model->saveMenu($request->param('menu'));
     return $this->view->json($this->resultArray($result, null));
 }