예제 #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;
 }
예제 #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()]);
 }
예제 #3
0
 public function SaveMenu(Request $request)
 {
     $result = $this->model->saveMenu($request->param('menu'));
     return $this->view->json($this->resultArray($result, null));
 }