:::

3-2 index.php

<?php
require_once 'function.php';
require_once 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;

$db = link_db();

$op = isset($_REQUEST['op']) ? filter_var($_REQUEST['op']) : '';
switch ($op) {

    default:
        list_article();
        break;
}

$smarty->display('index.tpl');

//讀出所有文章
function list_article()
{
    global $db, $smarty;

    $sql    = "SELECT * FROM `article` ORDER BY `update_time` DESC";
    $result = $db->query($sql) or die($db->error);
    $all    = [];
    while ($data = $result->fetch_assoc()) {
        $all[] = $data;
    }
    // die(var_export($all));
    $smarty->assign('all', $all);
}

 


:::

搜尋

QR Code 區塊

https%3A%2F%2Fmail.tad0616.cp22.secserverpros.com%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1347%26tbsn%3D43

書籍目錄

展開 | 闔起

線上使用者

272人線上 (110人在瀏覽線上書籍)

會員: 0

訪客: 272

更多…