當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Library::getBooks方法代碼示例

本文整理匯總了PHP中Library::getBooks方法的典型用法代碼示例。如果您正苦於以下問題:PHP Library::getBooks方法的具體用法?PHP Library::getBooks怎麽用?PHP Library::getBooks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Library的用法示例。


在下文中一共展示了Library::getBooks方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Library

<?php

include "library.php";
$lib = new Library();
if (isset($_GET['action'])) {
    switch ($_GET['action']) {
        case "getBooks":
            $data = $lib->getBooks();
            break;
        case "greetStudent":
            $data = $lib->greetStudent(filter_input(INPUT_GET, 'name', FILTER_SANITIZE_STRING));
            break;
        default:
            // PHP 5.4+ only, use code below for earlier versions
            http_response_code(400);
            // PHP < 5.4 use the line below instead
            // header("Status: 400", false, 400);
            $data = array("error" => "bad request");
    }
    header("Content-Type: application/json");
    echo json_encode($data);
}
開發者ID:rizalwildan,項目名稱:ws,代碼行數:22,代碼來源:rpc-wrapper.php

示例2: getBooksJson

 /**
  * http://localhost/debug/books-json
  *
  * @return String
  */
 public function getBooksJson()
 {
     # Old school way of getting books using the Library class and books.json
     # We've since updated this method with the Book model class and `books` table
     # Instantiating an object of the Library class
     $library = new Library(app_path() . '/database/books.json');
     # Get the books
     $books = $library->getBooks();
     # Debug
     return Pre::render($books, 'Books');
 }
開發者ID:rebekahheacock,項目名稱:dwa15-archive,代碼行數:16,代碼來源:DebugController.php


注:本文中的Library::getBooks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。