:::

11. api.php

<?php
require_once "NewsRest.php";
$NewsRest = new NewsRest();

// 過濾外來變數
$op      = isset($_REQUEST['op']) ? filter_var($_REQUEST['op'], FILTER_SANITIZE_STRING) : 'index';
$p       = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 1;
$id      = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$cate_id = isset($_REQUEST['cate_id']) ? (int) $_REQUEST['cate_id'] : 0;
$keyword = isset($_REQUEST['keyword']) ? filter_var($_REQUEST['keyword'], FILTER_SANITIZE_STRING) : '';
$year    = isset($_REQUEST['year']) ? (int) $_REQUEST['year'] : 0;

switch ($op) {
    case 'index':
        echo $NewsRest->index($p, $cate_id, $keyword, $year);
        break;

    case 'show':
        echo $NewsRest->show($id);
        break;

    case 'count':
        echo $NewsRest->count();
        break;
}

 


:::

書籍目錄

展開 | 闔起

快速登入


https%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1878%26tbsn%3D53

計數器

今天: 6110611061106110
昨天: 2489248924892489
總計: 8028092802809280280928028092802809280280928028092