本文整理汇总了PHP中Rest::sendResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP Rest::sendResponse方法的具体用法?PHP Rest::sendResponse怎么用?PHP Rest::sendResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rest
的用法示例。
在下文中一共展示了Rest::sendResponse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$url->setModelFirstPart($value);
} elseif ($key % 2 != 0) {
if (!empty($value) && !is_numeric($value)) {
throw new InvalidArgumentException('Second Argument must be an integer !');
} elseif ($key === 1 && is_numeric($value)) {
$url->setIdFirstPart($value);
} elseif (is_numeric($value)) {
$url->setIdSecondPart($value);
}
} elseif ($key % 2 == 0) {
if ($key === 2 && !is_numeric($value)) {
$url->setModelSecondPart($value);
}
}
}
} catch (InvalidArgumentException $e) {
print $e->getMessage();
exit;
}
/**
* Define the used model by analyze the object URL
* and his attributes. After include the controller to use.
*/
$model = constructRoute($url);
if (existController($model)) {
include_once APPLICATION_PATH . '/controllers/' . $model . '.controller.php';
} elseif ($model === '') {
include_once APPLICATION_PATH . '/controllers/default.controller.php';
} else {
Rest::sendResponse(404);
}
示例2: Picture
}
break;
case 'delete':
$picture_ = new Picture();
$pictureMapper = new \PictureMapper();
if ($pictureMapper->deletePicture()) {
Rest::sendResponse(200);
}
break;
case 'put':
try {
$picture_ = new Picture();
$data_picture_ = $http->getRequestVars();
$pictureObject = initObject($data_picture_, $picture_, true);
if (!emptyObject($pictureObject)) {
$pictureMapper = new \PictureMapper();
if ($pictureMapper->updatePicture($pictureObject)) {
Rest::sendResponse(200);
}
} else {
throw new InvalidArgumentException('Need arguments to UPDATE data !');
}
} catch (InvalidArgumentException $e) {
print $e->getMessage();
exit;
}
break;
default:
Rest::sendResponse(501);
break;
}