本文整理汇总了PHP中Api::getItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::getItem方法的具体用法?PHP Api::getItem怎么用?PHP Api::getItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::getItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Api
<?php
@session_start();
require_once 'Api.php';
$bookId = $_REQUEST['bookId'];
$api = new Api();
$errors = array();
$response = $api->getItem($bookId, 'book');
$userInfoResult = $api->getCurrentUserInfo();
//add a log of the item that is being viewed
if ($userInfoResult['result'] == 'SUCCESS') {
$bUserid = $userInfoResult['data']['bUserid'];
$viewedItemResult = $api->addItemsViewed($bookId, $bUserid);
}
//get recommended items
$recommendedItems = array();
if ($userInfoResult['result'] == 'SUCCESS') {
$recommededItemsResult = $api->getRecommendedItems($bUserid, 'book', $bookId);
if ($recommededItemsResult['result'] == 'SUCCESS') {
$recommendedItems = $recommededItemsResult['data'];
}
}
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
if (isset($_REQUEST['buyNow']) && $_REQUEST['buyNow'] == 'buyNow') {
$result = $api->getCurrentUserInfo();
if ($result['result'] == 'SUCCESS') {
$bUserid = $result['data']['bUserid'];
$buyResult = $api->buyItem($bUserid, $bookId, 'book', $response['data']['askingPrice']);
if ($buyResult['result'] == 'SUCCESS') {
header("Location: listbooks.php?status=itemPurchased");
die;
示例2: array
$viewedItemResult = $api->addItemsViewed($houseId, $bUserid);
}
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
$result = $api->getCurrentUserInfo();
if ($result['result'] == 'SUCCESS') {
$newBidAmount = $_REQUEST['newBidAmount'];
$bUserid = $result['data']['bUserid'];
$response = $api->addBid($houseId, $bUserid, $newBidAmount);
} else {
$errors[] = 'Unable to add bid because you are not logged in.';
}
} else {
//nothing to do here
}
$houses = array();
$response = $api->getItem($houseId, 'house');
$bidResponse = $api->viewBidHistory(2, $houseId);
$maxBidResponse = $api->getMaxBidAmount($houseId);
$maxBidAmount = $maxBidResponse['data']['maxBidAmount'];
$house = $response['data'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include 'htmlhead.php';
?>
</head>
<body>