本文整理汇总了PHP中AjaxResponse::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP AjaxResponse::setStatus方法的具体用法?PHP AjaxResponse::setStatus怎么用?PHP AjaxResponse::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AjaxResponse
的用法示例。
在下文中一共展示了AjaxResponse::setStatus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
protected function error($msg)
{
$this->setNoRender();
$this->_request->setDispatched(true);
if ($this->_request->isXmlHttpRequest()) {
$arp = new AjaxResponse();
$arp->setStatus(AjaxResponse::STATUS_FAILED);
$arp->setMessage($msg);
$this->json($arp);
} else {
$this->view->msg = $msg;
$this->renderScript('common/error.phtml');
}
}
示例2: sendResult
protected function sendResult($result = '')
{
$arp = new AjaxResponse();
$arp->setStatus(AjaxResponse::STATUS_OK);
$arp->setMessage($result);
$this->json($arp);
}
示例3: signInAction
public function signInAction()
{
if (!$this->_request->isXmlHttpRequest()) {
return;
}
$arp = new AjaxResponse();
$arp->setStatus(AjaxResponse::STATUS_FAILED);
$email = trim($this->_getParam('email'));
$password = trim($this->_getParam('password'));
if (empty($email) || empty($password)) {
$arp->setMessage('E-mail and password can not be empty.');
$this->json($arp);
return;
}
$hashedPassword = hash('sha256', $password);
$user = new Model_User($email);
if (!$user->exists() || $user->get('password') != $hashedPassword) {
$arp->setMessage('Authentication failed, You entered an incorrect username, or password.');
$this->json($arp);
return;
}
$this->setLoginCookie($email, $hashedPassword);
$arp->setStatus(AjaxResponse::STATUS_OK);
$this->json($arp);
}
示例4: addOrderConversationAction
public function addOrderConversationAction()
{
$sn = trim($this->_getParam('sn'));
$message = trim($this->_getParam('message'));
$imageUrl = $this->_getParam('imageUrl');
$oc = new Model_OrderConversation();
$oc->set('sn', $sn);
$oc->set('sender', Model_OrderConversation::SENDER_CS);
$oc->set('message', $message);
$oc->set('image_url', $imageUrl);
$oc->set('created_time', time());
$oc->save();
$arp = new AjaxResponse();
$arp->setStatus(AjaxResponse::STATUS_OK);
$this->json($arp);
$c = new ApiControllerAbstract();
$c->sendPush(Model_OrderConversation::SENDER_CS, $sn, $message);
}