本文整理汇总了PHP中CHttpRequest::getPost方法的典型用法代码示例。如果您正苦于以下问题:PHP CHttpRequest::getPost方法的具体用法?PHP CHttpRequest::getPost怎么用?PHP CHttpRequest::getPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHttpRequest
的用法示例。
在下文中一共展示了CHttpRequest::getPost方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: respondIfAjaxRequest
/**
*
* @param CHttpRequest $request
* @param User $model
*/
private function respondIfAjaxRequest($request, $model)
{
$ajaxRequest = $request->getPost('ajax', false);
if (!$ajaxRequest or $ajaxRequest !== 'signup-form') {
return;
}
echo CActiveForm::validate($model, array('email', 'password', 'verifyCode'));
Yii::app()->end();
}
示例2: processCheckout
/**
* @param Payment $payment
* @param CHttpRequest $request
* @return bool|static
*/
public function processCheckout(Payment $payment, CHttpRequest $request)
{
$orderId = (int) $request->getPost('order');
if (!$orderId) {
return false;
}
$order = Order::model()->findByPk($orderId);
if (null === $order) {
return false;
}
if ($order->pay($payment, Order::PAID_STATUS_NOT_PAID)) {
return $order;
}
return false;
}
示例3: actionRating
public function actionRating()
{
if (!($rating = MovieRating::model()->find('movie_id=:movie_id AND user_id=:user_id', array(':movie_id' => CHttpRequest::getPost('id'), ':user_id' => Yii::app()->user->id)))) {
$rating = new MovieRating();
$rating->movie_id = CHttpRequest::getPost('id');
$rating->user_id = Yii::app()->user->id;
}
$rating->value = CHttpRequest::getPost('rate');
$rating->save();
var_dump($rating);
}
示例4: getPost
/**
* Returns the named POST parameter value, or the entire POST array if no name is specified.
* If $name is specified and the POST parameter does not exist, $defaultValue will be returned.
*
* @param null $name The POST parameter name or null. If $name is null, it will return the entire POST array.
* @param null $defaultValue The default parameter value is $name is not null and the POST parameter does not exist.
* @return mixed|null
*/
public function getPost($name = null, $defaultValue = null)
{
if (!$name) {
return $_POST;
} else {
return parent::getPost($name, $defaultValue);
}
}