public function index() { parent::index(); if ($this->request->hasKey('album') && !$this->request->hasKey('photo')) { $this->view->showcase = $this->helper->getPhotosForShowcase($this->request->container['album']); $this->view->left = 'Znajdujesz sie w albumie: ' . $this->helper->getSingleAlbumName($this->request->container['album']); $this->view->show('profile_photos'); } else { if ($this->request->hasKey('photo')) { $this->view->showcase = $this->helper->getSinglePhoto($this->request->container['photo']); $this->view->left = 'Znajdujesz sie w albumie: ' . $this->helper->getSingleAlbumName($this->request->container['album']); $this->view->right = $this->helper->getPrevious($this->request->container['album'], $this->request->container['photo']) . $this->helper->getNext($this->request->container['album'], $this->request->container['photo']); $this->view->show('profile_photo'); } else { $this->view->showcase = $this->helper->getAlbumForShowcase(); $this->view->show('profile_albums'); } } }
$stmt->setFetchMode(PDO::FETCH_ASSOC); $res = $stmt->fetchAll(); foreach ($res as $k => $v) { $this->res[$k]['bannerList'] = explode(',', $v['picture']); $this->res[$k]['info']['name'] = $v['name']; $this->res[$k]['info']['describe'] = $v['description']; $this->res[$k]['info']['commentNum'] = $v['comment_number']; $this->res[$k]['info']['goneNum'] = $v['went_number']; $this->res[$k]['info']['wantNum'] = $v['want_number']; $this->res[$k]['info']['address'] = $v['location']; $this->res[$k]['info']['openTime'] = $v['open_time']; $this->res[$k]['info']['playTime'] = $v['play_time']; $this->res[$k]['info']['phone'] = $v['phone']; $this->res[$k]['info']['price'] = $v['price']; } if ($res) { $this->res['code'] = 0; $this->res['message'] = 'success'; } else { $this->res['code'] = 1065; $this->res['message'] = '查询数据库失败'; } } function __destruct() { $this->die_json($this->res); } } $view = new View(); $view->index();