本文整理汇总了PHP中Book::getAllBooks方法的典型用法代码示例。如果您正苦于以下问题:PHP Book::getAllBooks方法的具体用法?PHP Book::getAllBooks怎么用?PHP Book::getAllBooks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Book
的用法示例。
在下文中一共展示了Book::getAllBooks方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleGET
function handleGET($conn)
{
$books = Book::getAllBooks($conn);
//var_dump($books);//* wyswietlenie w formacie tablicy assocjacyjnej
$json = json_encode($books);
//* wyswietlanie w fromacie Json
echo $json;
}
示例2: handleGET
function handleGET()
{
$conn = Connection::startConnection();
$books = Book::getAllBooks($conn);
header('Content-type: application/json');
$json = json_encode($books);
echo $json;
Connection::stopConnecion($conn);
}
示例3: testGetAllBooks
public function testGetAllBooks()
{
// All books by first letter
$entryArray = Book::getAllBooks();
$this->assertCount(9, $entryArray);
}
示例4: InitializeContent
public function InitializeContent()
{
$this->title = localize("allbooks.title");
if (getCurrentOption("titles_split_first_letter") == 1) {
$this->entryArray = Book::getAllBooks();
} else {
list($this->entryArray, $this->totalNumber) = Book::getBooks($this->n);
}
$this->idPage = Book::ALL_BOOKS_ID;
}
示例5:
<?php
require_once "./src/connection.php";
if ($_SERVER['REQUEST_METHOD'] === 'GET' && !isset($_GET['id'])) {
$tab = [];
$tab = Book::getAllBooks();
echo json_encode($tab);
}
if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['id'])) {
$tab = Book::GetSingleBook($_GET['id']);
echo json_encode($tab);
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$newName = $_POST['title'];
$newAuthor = $_POST['author'];
$newDesc = $_POST['description'];
Book::AddBook($newName, $newAuthor, $newDesc);
echo json_encode([]);
}
if ($_SERVER['REQUEST_METHOD'] === 'DELETE') {
$toDel = json_decode(file_get_contents('php://input'));
Book::DeleteBook($toDel['id']);
echo json_encode([]);
}