本文整理汇总了PHP中AppController::getReturnedMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP AppController::getReturnedMessage方法的具体用法?PHP AppController::getReturnedMessage怎么用?PHP AppController::getReturnedMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppController
的用法示例。
在下文中一共展示了AppController::getReturnedMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register()
{
$message = "";
$status = false;
$code = '';
$data = array();
if ($this->request->is('post')) {
$this->User->create();
$data = array('username' => $this->data['username'], 'password' => $this->data['password'], 'role_id' => $this->data['role_id'], 'school_id' => $this->data['school_id'], 'level_id' => $this->data['level_id'], 'first_name' => $this->data['first_name'], 'father_name' => $this->data['father_name'], 'grandfather_name' => $this->data['grandfather_name'], 'family_name' => $this->data['family_name'], 'address' => $this->data['address'], 'phone_number' => $this->data['phone_number'], 'mobile_number' => $this->data['mobile_number'], 'email' => $this->data['email'], 'nationality_id' => $this->data['nationality_id']);
if ($this->User->save($data)) {
$status = true;
$code = '203';
} else {
$code = '406';
}
}
$this->response->type('json');
$json_body = json_encode(array("message" => AppController::getReturnedMessage($code), "status" => $status, "code" => $code));
$this->response->body($json_body);
}
示例2: subjectDetails
public function subjectDetails($id)
{
$message = "";
$status = false;
$code = '';
$json_subject = array();
$this->render(false);
if (!$id) {
$code = '404';
} else {
$subject = $this->Subject->findById($id);
if (!$subject) {
$code = '404';
} else {
$json_subject = $subject['Subject'];
$code = "200";
$status = true;
}
}
$this->response->type('json');
$json_body = json_encode(array("comments" => $json_subject, "message" => AppController::getReturnedMessage($code), "status" => $status, "code" => $code));
$this->response->body($json_body);
}
示例3: editComment
public function editComment()
{
$message = "";
$status = false;
$code = '';
$this->render(false);
if ($this->request->is('get')) {
throw new MethodNotAllowedException();
}
$id = $this->data['id'];
$user_id = $this->data['user_id'];
$data = array('id' => $this->data['id'], 'user_id' => $this->data['user_id'], 'subject_id' => $this->data['subject_id'], 'body' => $this->data['body']);
if ($this->Comment->isOwendBy($id, $user_id)) {
if ($this->Comment->save($data)) {
$status = true;
$code = '200';
} else {
$code = '409';
}
} else {
$code = '408';
}
$this->response->type('json');
$json_body = json_encode(array("message" => AppController::getReturnedMessage($code), "status" => $status, "code" => $code));
$this->response->body($json_body);
}