本文整理汇总了PHP中Books::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Books::update方法的具体用法?PHP Books::update怎么用?PHP Books::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Books
的用法示例。
在下文中一共展示了Books::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Books
break;*/
// Books related api
case 'add':
require_once 'Models/Books.php';
$S = new Books();
echo json_encode($S->add($D));
break;
case 'remove':
require_once 'Models/Books.php';
$S = new Books();
echo json_encode($S->remove($D['bookid']));
break;
case 'update':
require_once 'Models/Books.php';
$S = new Books();
echo json_encode($S->update($D['id'], $D));
break;
// User related api
/*case 'info':
require_once('Models/User.php');
$S = new User();
echo json_encode($S->info());
break;*/
// User related api
/*case 'info':
require_once('Models/User.php');
$S = new User();
echo json_encode($S->info());
break;*/
default:
# Wrong action.
示例2: switch
if (isset($_REQUEST["id"])) {
$id = $_REQUEST["id"];
$b = $book->getBookInfo($id);
if (!$b) {
$page->show404();
}
switch ($action) {
case 'submit':
$coverLoc = WWW_DIR . "covers/book/" . $id . '.jpg';
if ($_FILES['cover']['size'] > 0) {
$tmpName = $_FILES['cover']['tmp_name'];
$file_info = getimagesize($tmpName);
if (!empty($file_info)) {
move_uploaded_file($_FILES['cover']['tmp_name'], $coverLoc);
}
}
$_POST['cover'] = file_exists($coverLoc) ? 1 : 0;
$_POST['publishdate'] = empty($_POST['publishdate']) || !strtotime($_POST['publishdate']) ? $con['publishdate'] : date("Y-m-d H:i:s", strtotime($_POST['publishdate']));
$book->update($id, $_POST["title"], $_POST['asin'], $_POST['url'], $_POST["author"], $_POST["publisher"], $_POST["publishdate"], $_POST["cover"]);
header("Location:" . WWW_TOP . "/book-list.php");
die;
break;
case 'view':
default:
$page->title = "Book Edit";
$page->smarty->assign('book', $b);
break;
}
}
$page->content = $page->smarty->fetch('book-edit.tpl');
$page->render();