• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Book类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Book的典型用法代码示例。如果您正苦于以下问题:PHP Book类的具体用法?PHP Book怎么用?PHP Book使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Book类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: procGetIDNum

 private function procGetIDNum($session)
 {
     $queryType = @$_GET['type'];
     shell_exec("java PHPHandler requestRFIDTagId");
     $idNum = (string) shell_exec("java PHPHandler downloadRFID");
     if ($queryType == "add") {
         $session->form->setValue("rfid", $idNum);
         $_SESSION['value_array'] = $session->form->getValueArray();
         session_write_close();
         header("Location: bookProcess.php?submitBookChanges&type=" . $queryType);
     } else {
         if ($queryType == "change" || $queryType == "remove") {
             $book = new Book();
             $result = $book->getBookCallNo($idNum);
             $callNo = $result['CallNo'];
             header("Location: bookProcess.php?setupChangeList&type=" . $queryType . "&callNo=" . $callNo . "");
         } else {
             if ($queryType == "checkinout") {
                 $book = new Book();
                 $result = $book->getBookCallNo($idNum);
                 $callNo = $result['CallNo'];
                 header("Location: librarianProcess.php?checkinout&s=1&callNo=" . $callNo . "");
             }
         }
     }
 }
开发者ID:jpoon,项目名称:RFID-Library-Management-System,代码行数:26,代码来源:serialProcess.php


示例2: books

 function books()
 {
     $objs = new Book();
     $objs->get();
     $data = array('books' => $objs);
     $this->load->view('backend/books', $data);
 }
开发者ID:pojok-webdev,项目名称:pattimura,代码行数:7,代码来源:adm.php


示例3: testFormatALotOfResults

 public function testFormatALotOfResults()
 {
     $nbBooks = 50;
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     Propel::disableInstancePooling();
     $book = new Book();
     for ($i = 0; $i < $nbBooks; $i++) {
         $book->clear();
         $book->setTitle('BookTest' . $i);
         $book->save($con);
     }
     $stmt = $con->query('SELECT * FROM book');
     $formatter = new PropelOnDemandFormatter();
     $formatter->init(new ModelCriteria('bookstore', 'Book'));
     $books = $formatter->format($stmt);
     $this->assertTrue($books instanceof PropelOnDemandCollection, 'PropelOnDemandFormatter::format() returns a PropelOnDemandCollection');
     $this->assertEquals($nbBooks, count($books), 'PropelOnDemandFormatter::format() returns a collection that counts as many rows as the results in the query');
     $i = 0;
     foreach ($books as $book) {
         $this->assertTrue($book instanceof Book, 'PropelOnDemandFormatter::format() returns a collection of Model objects');
         $this->assertEquals('BookTest' . $i, $book->getTitle(), 'PropelOnDemandFormatter::format() returns the model objects matching the query');
         $i++;
     }
     Propel::enableInstancePooling();
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:25,代码来源:PropelOnDemandFormatterTest.php


示例4: testGetId

 function testGetId()
 {
     $name = "Randy Mclure";
     $test_patron = new Book($name);
     $result = $test_patron->getId();
     $this->assertEquals(null, $result);
 }
开发者ID:umamiMike,项目名称:Library,代码行数:7,代码来源:PatronTest.php


示例5: update

 function update()
 {
     $params = $this->input->post();
     $obj = new Book();
     $obj->where('id', $params['id'])->update($params);
     echo $obj->check_last_query();
 }
开发者ID:pojok-webdev,项目名称:pattimura,代码行数:7,代码来源:books.php


示例6: bookInsertion

 function bookInsertion($title, $ISBN, $author)
 {
     $book = new \Book(['title' => $title, 'isbn' => $ISBN]);
     $book->link('author', $author);
     $book->save();
     return $book;
 }
开发者ID:githubjeka,项目名称:php-orm-benchmark,代码行数:7,代码来源:TestDefault.php


示例7: __construct

 /**
  * __construct method
  */
 public function __construct(View $view, $settings = array())
 {
     parent::__construct($view, $settings);
     App::import("Model", 'Book');
     $Book = new Book();
     $this->calibrePath = $Book->getCalibrePath();
 }
开发者ID:cc2i,项目名称:calibrephp,代码行数:10,代码来源:ImageHelper.php


示例8: hallAction

 public function hallAction()
 {
     $this->view->loginuser = $_SESSION['loginuser'];
     $book = new Book();
     $res = $book->fetchAll()->toArray();
     $this->view->res = $res;
 }
开发者ID:yuxujian,项目名称:YuNote,代码行数:7,代码来源:HallController.php


示例9: test_create_from_array

 public function test_create_from_array()
 {
     $data = array('title' => 'New Book', 'author_id' => '1', 'quantity' => '500', 'price' => '7.77');
     // 'New Book' doesn't exist
     // i.e. test may be invalid
     $book = new Book();
     $book = $book->find_by_title('New Book');
     if (count($book) != 0) {
         $this->errors['create_from_array'][] = 'pre-exists';
     }
     $new_book = new Book();
     $new_book->create($data);
     // 'New Book' was created
     // e.g. create() isn't working
     if (is_null($new_book->id)) {
         $this->errors['create_from_array'][] = 'new_book_id';
     }
     // 'New Book' can be fetched
     // e.g. update() isn't working
     $fetch_book = new Book();
     $fetch_book = $fetch_book->find_by_title('New Book');
     if (count($fetch_book) != 1) {
         $this->errors['create_from_array'][] = 'fetch_count';
     }
     if ($fetch_book[0]->id != $new_book->id) {
         $this->errors['create_from_array'][] = 'fetch_id_match';
     }
 }
开发者ID:TheOddLinguist,项目名称:toolbox,代码行数:28,代码来源:tester.norm.create.php


示例10: test_update_from_array

 public function test_update_from_array()
 {
     $data = array('title' => 'New Book', 'author_id' => '1', 'quantity' => '500', 'price' => '7.77');
     // Create Book to test
     $new_book = new Book();
     $new_book->create($data);
     // 'New Book' exists
     // i.e. test may be invalid
     $book = new Book();
     $book = $book->find_by_title('New Book');
     if (count($book) == 0) {
         $this->errors['update_from_array'][] = 'non-existent';
     }
     if (count($book) > 1) {
         $this->errors['update_from_array'][] = 'too_many';
     }
     $new_data = array('author_id' => '2', 'quantity' => '600', 'price' => '8.88');
     $update_book = new Book();
     $update_book = $update_book->first_by_title('New Book');
     $update_book->update($new_data);
     // Fetch book
     // e.g. update() isn't working
     $fetch_book = new Book();
     $fetch_book = $fetch_book->first_by_title('New Book');
     if ($fetch_book->author_id != 2) {
         $this->errors['update_from_array'][] = 'author_id';
     }
     if ($fetch_book->quantity != 600) {
         $this->errors['update_from_array'][] = 'quantity';
     }
     if ($fetch_book->price != '8.88') {
         $this->errors['update_from_array'][] = 'price';
     }
 }
开发者ID:TheOddLinguist,项目名称:toolbox,代码行数:34,代码来源:tester.norm.update.php


示例11: testTicket2

 public function testTicket2()
 {
     $obj = new Book();
     $obj->set('name', 'yes2');
     $obj->save();
     $this->assertEqual($obj->get('name'), 'yes2');
     $obj->save();
 }
开发者ID:dennybrandes,项目名称:doctrine1,代码行数:8,代码来源:381TestCase.php


示例12: process

 /**
  * @return bool
  * @throws Exception
  */
 public function process()
 {
     $bookModel = new Book();
     if (!$bookModel->load($this->data) || !$bookModel->validate()) {
         throw new Exception('Invalid data!');
     }
     return $bookModel->delete();
 }
开发者ID:alfytu,项目名称:booklibrary,代码行数:12,代码来源:Delete.php


示例13: testWeCanCreateABookWithInformation

 public function testWeCanCreateABookWithInformation()
 {
     $title = 'New Title';
     $author = "Author";
     $book = new Book($title, $author);
     $this->assertEquals($title, $book->getTitle());
     $this->assertEquals($author, $book->getAuthor());
 }
开发者ID:Witoso,项目名称:learningphp,代码行数:8,代码来源:BookTest.php


示例14: removeBook

 public function removeBook(Book $bookToRemove)
 {
     foreach ($this->books as $key => $book) {
         /** @var Book $book */
         if ($book->getAuthorAndTitle() === $bookToRemove->getAuthorAndTitle()) {
             unset($this->books[$key]);
         }
     }
 }
开发者ID:miaokuan,项目名称:DesignPatternsPHP,代码行数:9,代码来源:BookList.php


示例15: bookInsertion

 function bookInsertion($title, $ISBN, $author)
 {
     $book = new \Book();
     $book->title = $title;
     $book->isbn = $ISBN;
     $book->author()->associate($author);
     $book->save();
     return $book;
 }
开发者ID:Big-Shark,项目名称:php-orm-benchmark,代码行数:9,代码来源:TestDefault.php


示例16: removeBook

 public function removeBook(Book $bookToRemove)
 {
     foreach ($this->books as $key => $book) {
         if ($book->getAuthorAndTitle() === $bookToRemove->getAuthorAndTitle()) {
             unset($this->books[$key]);
         }
     }
     $this->books = array_values($this->books);
 }
开发者ID:paul-schulleri,项目名称:DesignPatternsPHP,代码行数:9,代码来源:BookList.php


示例17: handlePUT

function handlePUT(mysqli $conn)
{
    parse_str(file_get_contents("php://input"), $data);
    $book = new Book();
    $book->update($conn, $data['id']);
    $book->setTitle($data['title']);
    $book->setAuthor($data['author']);
    $book->setDesc($data['desc']);
}
开发者ID:RyszardRzepa,项目名称:REST_API,代码行数:9,代码来源:Books.php


示例18: process

 /**
  * @return bool
  * @throws Exception
  */
 public function process()
 {
     $bookModel = new Book();
     if ($bookModel->load($this->data) && $bookModel->validate()) {
         $bookModel->save();
         return (array) $bookModel;
     }
     throw new Exception('Invalid data!');
 }
开发者ID:alfytu,项目名称:booklibrary,代码行数:13,代码来源:Set.php


示例19: testAddingABook

 public function testAddingABook()
 {
     $author = AuthorPeer::retrieveByPK($this->author->getId());
     $c1 = new Book();
     $c1->setTitle("ORM 101");
     $author->addBook($c1);
     $this->assertEquals(3, count($author->getBooks()));
     $this->assertEquals(3, $author->countBooks());
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:9,代码来源:PoisonedCacheBugTest.php


示例20: removeBook

 /**
  * Remove book from student (lost or returned to library @see Library )
  *
  * @param Book $book
  *
  * @throws Exception
  */
 public function removeBook(Book $book)
 {
     if (in_array($this->books, $book->getId())) {
         if (($key = array_search($book->getId(), $this->books)) !== false) {
             unset($this->books[$key]);
         }
     } else {
         throw new Exception("Warning, book cannot be deleted - there are no such book owned by student");
     }
 }
开发者ID:Tidynar,项目名称:University,代码行数:17,代码来源:Man.php



注:本文中的Book类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP BookPeer类代码示例发布时间:2022-05-23
下一篇:
PHP BoincUser类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap