當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Ajax::get方法代碼示例

本文整理匯總了PHP中Ajax::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Ajax::get方法的具體用法?PHP Ajax::get怎麽用?PHP Ajax::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Ajax的用法示例。


在下文中一共展示了Ajax::get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ajax

 /**
  * Process ajax request
  * 
  * @return array
  */
 public function ajax()
 {
     if (!$this->is_ajaxed) {
         return NULL;
     }
     $result = array();
     $action = Ajax::get('action', 'replace');
     $result['action'] = $action;
     $result['id'] = $this->getId();
     switch ($action) {
         case 'replace':
             $this->setValue(NULL);
             $result['code'] = $this->render();
             break;
     }
     event('form.element.ajax', $this, $result);
     return $result;
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:23,代碼來源:Abstract.php

示例2: edit_action

 /**
  * Edit action
  * 
  * @param   string  $login
  */
 public function edit_action($id = NULL)
 {
     $id or $id = $this->user->id;
     $user = new User_Object();
     $this->db->where('id', $id);
     if (!$user->find()) {
         return _404();
     }
     if (!access('user edit_all') && $this->id != $user->id) {
         return _403();
     }
     $this->renderUserInfo($user);
     $user = new User_Object();
     $user->where('id', $id);
     $user->find();
     $form = new Form('User.profile');
     $user->password = '';
     $form->object($user->object());
     if ($form->elements->avatar->is_ajaxed && Ajax::get('action') == 'replace') {
         $user->avatar = '';
         $user->update();
     }
     if ($result = $form->result()) {
         if ($user->login != $result['login']) {
             $redirect = Url::gear('user') . $result['login'];
         }
         if ($result->delete && access('users delete_all')) {
             $user->delete();
             flash_success(t('User <b>%s</b> was deleted!'));
             redirect(Url::link('/users'));
         }
         $user->merge($result);
         if ($result->password) {
             $user->hashPassword();
         } else {
             unset($user->password);
         }
         if ($user->update()) {
             d('User edit');
             flash_success(t('User data saved!'), t('Success'));
             d();
             if ($user->id == $this->id) {
                 $this->store($user->object()->toArray());
             }
             redirect(Url::gear('user') . $user->login);
         }
     }
     append('content', $form->render());
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:54,代碼來源:Gear.php

示例3: result

 /**
  * Result
  *
  * @return  NULL|Core_ArrayObject — filtered and validated data
  */
 public function result()
 {
     $this->init();
     event('form.result.before', $this);
     event('form.' . $this->name . '.result.before', $this);
     $this->request = $this->method == 'POST' ? $_POST : $_GET;
     $result = array();
     $is_valid = TRUE;
     if (sizeof($this->request) > 0) {
         foreach ($this->elements as $name => $element) {
             $value = $element->result();
             if ($value !== FALSE) {
                 $result[$name] = $value;
             } else {
                 $is_valid = FALSE;
             }
         }
     }
     if ($this->is_ajaxed) {
         $response = array();
         foreach ($this->elements as $name => $element) {
             if ($name == Ajax::get('element')) {
                 if ($result = $element->ajax()) {
                     $response[$name] = $result;
                 }
             }
         }
         event('form.ajax.before', $this, $response);
         event('form.' . $this->name . '.ajax.before', $this, $response);
         $response && Ajax::json($response);
     }
     event('form.result.after', $this, $is_valid, $result);
     event('form.' . $this->name . '.result.after', $this, $is_valid, $result);
     return $is_valid && $result ? Core_ArrayObject::transform($result) : FALSE;
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:40,代碼來源:Object.php


注:本文中的Ajax::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。