query($sql) or die($db->error); $data = $result->fetch_assoc(); $data['content'] = $purifier->purify($data['content']); $smarty->assign('article', $data); } //讀出所有文章 function list_article() { global $db, $smarty; $sql = "SELECT * FROM `article` ORDER BY `update_time` DESC LIMIT 0,9"; $result = $db->query($sql) or die($db->error); $all = []; $i = 0; while ($data = $result->fetch_assoc()) { $all[$i] = $data; $all[$i]['summary'] = mb_substr(strip_tags($data['content']), 0, 90); $i++; } // die(var_export($all)); $smarty->assign('all', $all); } ```
進階搜尋
63人線上 (15人在瀏覽線上書籍)
會員: 0
訪客: 63