本文整理匯總了PHP中json_success函數的典型用法代碼示例。如果您正苦於以下問題:PHP json_success函數的具體用法?PHP json_success怎麽用?PHP json_success使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了json_success函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
$u = new SwfUpload();
$t = new Thumbnail();
$u->files = $_FILES;
//設置file數組。(隻能單張)
//請記住先檢測,再上傳
$r = $u->check();
if ($r === true && ($r = $u->upload())) {
// echo_log($r);
if (!isset($r['error'])) {
// 生成200的縮略圖
$t->setSrcImg($r['savePath']);
$height = $t->getImgHeight();
$width = $t->getImgWidth();
if ($this->savePicture($r['saveName'], $r['title'], $width, $height)) {
// 生成小的縮略圖
$t->setDstImg($r['savePath'] . '_' . THUMBNAIL_WIDTH_SMALL);
$t->createImg(THUMBNAIL_WIDTH_SMALL);
// 生成打的縮略圖
$t->setSrcImg($r['savePath']);
$t->setDstImg($r['savePath'] . '_' . THUMBNAIL_WIDTH_LARGE);
$t->createImg(THUMBNAIL_WIDTH_LARGE);
$rt = array('thumbUrl' => $r['saveName'], 'title' => $r['title'], 'width' => $width, 'height' => $height);
json_success($rt);
} else {
json_failure('圖片信息入庫異常');
}
} else {
json_failure($r['error']);
}
} else {
json_failure($r['error']);
}
}
示例2: update
public function update()
{
$idx = user()->getIdx();
if ($idx) {
$meta = new PhilgoMeta();
$stamp = $meta->get("attend.complete.{$idx}");
if ($stamp) {
// 1 분 이내에 중복 신청이 안되도록 한다.
if ($stamp < time() - 60) {
// 총 포인트가 10만 점이 넘지 않도록 한다.
$point = $meta->get("total.event.point.{$idx}");
if ($point > 100000) {
json_success(array('code' => -40470, 'message' => "한도 초과: 포인트는 50,000 점까지만 획득 가능합니다."));
}
global $sys;
$d = array('idx_member' => $idx, 'idx_member_from' => $idx, 'point' => 77, 'idx_post' => 0, 'etc' => 'point event 2016-01-26');
$sys->point->update($d);
$meta->set("attend.complete.{$idx}", time());
$meta->set("total.event.point.{$idx}", $point + 77);
json_success(array('code' => 0, 'message' => "OK"));
} else {
$left = 60 - (time() - $stamp);
json_success(array('code' => -40450, 'message' => "너무 빠른 포인트 증가 시도입니다. {$left} 초 남았음."));
}
} else {
json_success(array('code' => -40449, 'message' => "출석 이벤트를 완료하십시오."));
}
} else {
json_success(array('code' => -40104, 'message' => "로그인을 하십시오."));
}
}
示例3: runAjax
public function runAjax()
{
$in = http_input();
$table = $in['table'];
$in['rows'] = $this->db->rows("SELECT * FROM {$table}");
json_success($in);
}
示例4: search
/**
* 搜索需求
*/
public function search()
{
$key = get_query('key');
if (empty($key)) {
this . getList();
}
$list = $this->pM->search($key, LIST_PPN, get_query('p', 1));
json_success(array('isEnd' => empty($list), 'list' => $list));
}
示例5: collect
/**
*
*
* @note 호출 예: http://philgo.org/?module=overframe&action=index&model=philgo.attend.collect&idx_member=test1016&session_id=a4c4d294aa2a91f25c326ae36d16d941&page=front&mobile=false&platform=isNotCordova
*
*/
public function collect()
{
$my_idx = user()->getID();
$ret = array();
for ($i = 9; $i >= 0; $i--) {
$date = date('Ymd', time() - 60 * 60 * 24 * $i);
$row = $this->row("user_id={$my_idx} AND date={$date}");
$row['ymd'] = preg_replace('/([0-9]{4})([0-9]{2})([0-9]{2})/', "\$1-\$2-\$3 ", $date);
$ret[] = $row;
}
json_success($ret);
}
示例6: execute_ajax_action
/**
* Выполнение ajax действия
*
* @param AjaxClassProvider $provider
*/
function execute_ajax_action(AbstractAjaxAction $action = null)
{
/* Для безопасности не будем писать детали обработки */
if (!$action) {
json_error('Действие не опеределено');
}
$result = $action->execute();
$result = $result ? $result : 'Ошибка выполнения действия';
if ($result instanceof AjaxSuccess) {
json_success($result->getJsParams());
}
json_error($result);
}
示例7: edit
/**
*
* @return void
*/
public function edit()
{
if ($this->input->is_ajax_request()) {
if (($domain = $this->input->post("domain")) !== NULL && $this->auth->has_right(Auth::ADMIN, $domain)) {
if ($domain !== "<new>" && !($this->data["domain"] = $this->domains_model->get($domain)) instanceof PA_DB_Domain) {
json_success($this->data["domain"]);
}
//add_js( "domains_edit", true );
$this->load->view('forms/domain_edit', $this->data);
return;
}
json_access_denied();
}
redirect($this->router->default_controller);
}
示例8: collect
/**
*
*
* @note HTTP 입력 변수로 condition 값이 들어오며 적절한 처리를 하여 JSON 으로 리턴한다.
*
* 내부적으로는 Entity::search() 를 사용하므로 where, limit, offset, page, order_by, fields 의 값을 그대로 사용 할 수 있다.
*
*
* &entity=데이터베이스 테이블
* &where=의 값은 entity->search() 의 where SQL 컨디션과 동일
* &order_by=SQL ORDER BY 컨디션
* &limit=, &offset=, &page= 의 값은 entity::search() 의 것과 동일
*
* @return JSON 내부의 동작은 entity::search() 의 것과 동일하지만, 결과는 JSON 으로 리턴한다.
*
* @code 쿼리 예제
* http://philgo.org/?module=overframe&action=index&model=entity.crud.collect&entity=data&order_by=id%20ASC&fields=id,finish,name&where=id%3E3&limit=3
* @endcode
*/
public function collect()
{
$in = http_input();
$o['fields'] = isset($in['fields']) ? $in['fields'] : '*';
$o['where'] = isset($in['where']) ? $in['where'] : null;
$o['order_by'] = isset($in['order_by']) ? $in['order_by'] : 'id DESC';
$o['limit'] = isset($in['limit']) ? $in['limit'] : 10;
$o['page'] = isset($in['page']) ? $in['page'] : 1;
$o['offset'] = isset($in['offset']) ? $in['offset'] : 0;
$entity_name = $in['entity'];
$node = node($entity_name);
$entities = $node->search($o);
$data = array();
foreach ($entities as $e) {
$data[] = $e->getRecord();
}
json_success($data);
}
示例9: array
$identifier = $icao == "" ? $iata : $icao;
$github = new \Github\Client();
$github->authenticate($GITHUB_ACCESS_TOKEN, NULL, Github\Client::AUTH_HTTP_TOKEN);
$issues = $github->api('search')->issues("repo:{$GITHUB_USER}/{$GITHUB_REPO} in:title {$identifier}");
if (count($issues['items']) > 0) {
// Existing issue, add comment
$issue_number = $issues['items'][0]['number'];
$result = $github->api('issue')->comments()->create($GITHUB_USER, $GITHUB_REPO, $issue_number, array('body' => $body));
} else {
// New issue
$result = $github->api('issue')->create($GITHUB_USER, $GITHUB_REPO, array('title' => $subject, 'body' => $body, 'labels' => array('airport')));
$issue_number = $result['number'];
}
if (TRUE) {
$message = "Edit submitted for review on Github: Issue {$issue_number}, {$result['html_url']}";
json_success(array("apid" => $apid, "message" => $message));
} else {
json_error("Could not submit edit for review, please contact <a href='/about'>support</a>.");
}
}
exit;
}
if (!$dbname) {
$dbname = "airports";
}
$sql = "SELECT * FROM " . mysql_real_escape_string($dbname) . " WHERE ";
if ($action == "LOAD") {
// Single-airport fetch
$sql .= " apid=" . mysql_real_escape_string($apid);
$offset = 0;
} else {
示例10: invoke_patients
public function invoke_patients()
{
$active = isset($_GET['active']) ? $_GET['active'] : "1";
//SELECT ALL //////////////////////////////////
if (get('do') == 'viewall') {
if (PAGINATION_TYPE == 'Normal') {
$result = $this->patients_model->SelectAll(RECORD_PER_PAGE, $active);
//Accept get url e.g (index.php?id=1&cat=2...)
$paging = pagination($this->patients_model->CountRow(), RECORD_PER_PAGE, '' . H_ADMIN . '&view=patients&do=viewall&active=' . $active);
} else {
$result = $this->patients_model->SelectAll(NULL, $active);
}
include APP_FOLDER . '/views/admin/patients/View.php';
}
//EXPORT ////////////////////////////////////////////////////
if (get('do') == 'export') {
$result = $this->patients_model->SelectAll(NULL, $active);
include APP_FOLDER . '/views/admin/patients/Export.php';
} elseif (get('do') == 'export2') {
$rows = $this->patients_model->SelectOne(get('id'));
include APP_FOLDER . '/views/admin/patients/Export2.php';
} elseif (get('do') == 'autosearch') {
$qstring = post('qstring');
if (strlen($qstring) > 0) {
$autosearch = $this->patients_model->AutoSearch(trim($qstring), 10, 'first_name');
echo ' <div class=widget><ul class="list-group">';
foreach ($autosearch as $srow) {
echo '<span class="searchheading"><a href="' . H_ADMIN . '&view=patients&id=' . $srow->id . '&do=details"><li class="list-group-item">' . $srow->first_name . ' ' . $srow->last_name . '</li></a>
</span>';
}
echo '</ul></div>';
}
} elseif (get('do') == 'add') {
include APP_FOLDER . '/views/admin/patients/Add.php';
} elseif (get('do') == 'addpro') {
if ($_POST) {
//form validation
if (post('first_name') == '') {
json_error('Pleas enter First Name!');
} elseif (post('last_name') == '') {
json_error('Please enter Last Name!');
} elseif (post('phone') == '') {
json_error('Please enter Phone!');
} elseif (post('email') == '') {
json_error('Please enter Email!');
} elseif (post('source') == '') {
json_error('Please select Source!');
} else {
$this->patients_model->Insert(post('first_name'), post('last_name'), post('phone'), post('email'), post('source'), post('notes'));
json_send('' . H_ADMIN . '&view=patients&do=viewall&msg=add');
json_success('Process Completed');
}
}
} elseif (get('do') == 'update') {
$rows = $this->patients_model->SelectOne(get('id'));
//check if patient have card
$have_card = patient_have_card(get('id'));
include APP_FOLDER . '/views/admin/patients/Update.php';
} elseif (get('do') == 'updatepro') {
if ($_POST) {
//form validation
if (post('id') == '') {
json_error('The field id cannot be empty!');
} elseif (post('first_name') == '') {
json_error('Please enter First Name!');
} elseif (post('last_name') == '') {
json_error('Please enter Last Name!');
} elseif (post('phone') == '') {
json_error('Please enter Phone!');
} elseif (post('email') == '') {
json_error('Please enter Email!');
} elseif (post('source') == '') {
json_error('Please select Source!');
} else {
$this->patients_model->Update(post('first_name'), post('last_name'), post('phone'), post('email'), post('source'), post('notes'), post('active'), post('id'));
json_send('' . H_ADMIN . '&view=patients&id=' . post('id') . '&do=details&msg=update');
json_success('Process Completed');
}
}
} elseif (get('do') == 'details') {
$rows = $this->patients_model->SelectOne(get('id'));
//check if patient have card
$have_card = patient_have_card(get('id'));
include APP_FOLDER . '/views/admin/patients/Details.php';
} elseif (get('do') == 'truncate') {
$this->patients_model->TruncateTable('' . H_ADMIN . '&view=patients&do=viewall&msg=truncate');
include APP_FOLDER . '/views/admin/patients/View.php';
} elseif (get('do') == 'delete') {
$dfile = get('dfile');
if (get('id') and $dfile == '') {
$del = $this->patients_model->Delete(get('id'), '' . H_ADMIN . '&view=patients&do=viewall&msg=delete');
} elseif (get('id') and $dfile != '' and get('fdel') == '') {
delete_files(UPLOAD_PATH . get('dfile'));
delete_files(THUMB_PATH . get('dfile'));
$del = $this->patients_model->Delete(get('id'), '' . H_ADMIN . '&view=patients&do=viewall&msg=delete');
} elseif (get('id') and $dfile != '' and get('fdel') != '') {
delete_files(UPLOAD_PATH . get('dfile'));
delete_files(THUMB_PATH . get('dfile'));
send_to('' . H_ADMIN . '&view=patients&id=' . get('id') . '&do=update&msg=delete');
}
//.........這裏部分代碼省略.........
示例11: hotspot_delete
/**
* Deletes a hotspot by its uuid
* @param string $uuid
*/
public function hotspot_delete($uuid = '')
{
validate_team_read(get_team_id());
$hotspot = validate_hotspot_uuid($uuid);
activity_delete_hotspot($hotspot->id);
$this->Hotspot->delete($hotspot->id);
json_success("Hotspot deleted successfully.");
}
示例12: forgot_password
/**
* @note: !!! Draft !!!
* @return type
*/
public function forgot_password()
{
if ($this->input->is_ajax_request() && $this->auth->type == Auth::ANONYMOUS) {
$this->load->model("auth_model");
if (($emailaddress = $this->input->post("emailaddress")) !== NULL && $this->auth_model->reset_password_request($emailaddress)) {
json_success(TRUE, lang("welcome_index_password_forget_request_success"));
}
json_error(FALSE, lang("welcome_index_password_forget_request_failed"));
}
redirect($this->router->class);
}
示例13: json_error
<?php
require_once 'AjaxTools.php';
$programmId = RequestArrayAdapter::inst()->int('id');
$errorMsg = null;
if (is_numeric($programmId)) {
GymManager::getInstance()->deleteProgramm($programmId);
} else {
$errorMsg = 'Не передан id программы';
}
if ($errorMsg) {
json_error($errorMsg);
} else {
json_success('success');
}
示例14: json_success
if (mysql_affected_rows() == 1) {
json_success(array("apid" => $apid, "message" => "Airport successfully edited."));
} else {
json_error("Editing airport failed:", $sql);
}
}
} else {
$subject = "OpenFlights: Airport edit";
$body = "New edit submitted by " . $_SESSION['name'] . " (" . $_SESSION['email'] . "):\n{$sql}\n\nExisting airport information:\n" . implode("\n", $duplicates);
$headers = "From: info+apsearch@openflights.org\r\nTo: info@openflights.org\r\nReply-To: " . $_SESSION['email'];
if (isset($_POST["unittest"])) {
echo $headers . "\n\n" . $body;
exit;
}
if (mail($email, $subject, $body, $headers)) {
json_success(array("apid" => $apid, "message" => "Edit submitted for review. If you have registered an e-mail address, you will be notified when the edit is reviewed."));
} else {
json_error("Could not submit edit for review, please contact <a href='/about'>support</a>.");
}
}
exit;
}
if (!$dbname) {
$dbname = "airports";
}
$sql = "SELECT * FROM " . mysql_real_escape_string($dbname) . " WHERE ";
if ($action == "LOAD") {
// Single-airport fetch
$sql .= " apid=" . mysql_real_escape_string($apid);
$offset = 0;
} else {
示例15: meeting_delete
/**
* Deletes a project by its uuid
* @param string $uuid
*/
public function meeting_delete($uuid = '')
{
$meeting = validate_meeting_uuid($uuid, true);
activity_delete_meeting($meeting->id);
$this->Meeting->delete($meeting->id);
json_success("Message deleted successfully.");
}