{ $spot_id = $this->get_spot(); var_dump($spot_id); die; $stmt = $this->db->prepare("select * from ft_view where spot_id=:spot_id LIMIT " . $this->num); $stmt->execute(array(':spot_id' => $spot_id)); $stmt->setFetchMode(PDO::FETCH_ASSOC); //设置获取模式 $res = $stmt->fetchAll(); if ($res) { $this->data['spotList'] = $res; } else { $this->data['spotList'] = 0; } } function __destruct() { if ($this->data['spotList']) { $this->data['code'] = 0; $this->data['message'] = 'success'; $this->die_json($this->data); } else { $this->data['code'] = -1; $this->data['message'] = 'fail'; $this->die_json($this->data); } } } $recommend = new Recommon(); $recommend->get_views();