public function actionIndex() { FLow::app()->request->getText("a"); $entry_acm = Flow::app()->acf->table("entry"); $comicnodes = $entry_acm->where("cat='cartoon'")->order("publish_date desc, `dsr_score` desc")->limit("30")->findall(); $movienodes = $entry_acm->where("cat='movie'")->order("publish_date desc, `dsr_score` desc")->limit("30")->findall(); $this->assign("comicnodes", $comicnodes); $this->assign("movienodes", $movienodes); $this->display(); }
/** * 查询DB的meta信息 * @param $table_name * @return array * @throws Exception */ private function _fetchTableInfo($table_name) { $f_cache = FLow::app()->file_cache; if (!DEV_MODE && null != $f_cache["db." . $this->dbb->dbname . "_" . $table_name]) { return $f_cache["db." . $this->dbb->dbname . "_" . $table_name]; } $dbh = $this->dbh; $ps = $dbh->query("desc {$table_name}"); if ($ps == false) { throw new Exception("Table {$table_name} doesn't Existed "); } $res_arr = $ps->fetchAll(PDO::FETCH_ASSOC); $col_infos = array(); foreach ($res_arr as $res) { $col_infos[$res["Field"]] = $res; if ($res["Key"] == "PRI") { //die($res["Field"]); } } $f_cache["db." . $this->dbb->dbname . "_" . $table_name] = $col_infos; return $col_infos; }
/** * 打印页面日志 * */ public static function showLogs() { // 打印日志 $errors = FLow::Log()->getDatas(); foreach ($errors as $message) { error_log("FlowPHP" . implode(" ", $message)); } if (DEV_MODE) { if (PHP_SAPI == 'cli') { $errors = FLow::Log()->getDatas(); foreach ($errors as $message) { echo implode(" ", $message); echo "\n"; } } else { echo Flow::Log()->getHTML(); } } }