当前位置: 首页>>代码示例>>PHP>>正文


PHP ajax函数代码示例

本文整理汇总了PHP中ajax函数的典型用法代码示例。如果您正苦于以下问题:PHP ajax函数的具体用法?PHP ajax怎么用?PHP ajax使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ajax函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMyList

 function getMyList()
 {
     $this->load->model('muser');
     $this->muser->check() or noRights();
     $res = $this->db->where("id in (SELECT yid FROM yue_people WHERE uid=" . UID . ")", null, FALSE)->select("id,uid,(SELECT name FROM user WHERE user.id=uid) authorName,(SELECT avatar FROM user WHERE user.id=uid) authorAvatar,title,time")->get('yue')->result_array();
     ajax(0, '', $res);
 }
开发者ID:smallp,项目名称:fishing,代码行数:7,代码来源:yue.php

示例2: action

 private static function action()
 {
     //禁止使用模块检测
     if (in_array(MODULE, C('http.deny_module'))) {
         throw new Exception("模块禁止访问");
     }
     $class = 'app\\' . MODULE . '\\controller\\' . CONTROLLER;
     //控制器不存在
     if (!class_exists($class)) {
         throw new Exception("{$class} 不存在");
     }
     $controller = Route::$app->make($class, TRUE);
     //执行控制器中间件
     \Middleware::performControllerMiddleware();
     //执行动作
     try {
         $reflection = new ReflectionMethod($controller, ACTION);
         if ($reflection->isPublic()) {
             //执行动作
             if ($result = call_user_func_array([$controller, ACTION], self::$routeArgs)) {
                 if (IS_AJAX && is_array($result)) {
                     ajax($result);
                 } else {
                     echo $result;
                 }
             }
         } else {
             throw new ReflectionException('请求地址不存在');
         }
     } catch (ReflectionException $e) {
         $action = new ReflectionMethod($controller, '__call');
         $action->invokeArgs($controller, [ACTION, '']);
     }
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:34,代码来源:Controller.php

示例3: overlay2

 function overlay2()
 {
     $ajax = ajax();
     $rules = array('rules' => array('a[name]' => array('required' => true, 'minlength' => 5), 'a[last_name]' => array('required' => true, 'minlength' => 5)), 'messages' => array('a[name]' => array('required' => 'Please enter your name'), 'a[last_name]' => array('required' => 'Enter your last name')));
     $overlay = $ajax->overlayContent(file_get_contents('resources/html/test_form.html'));
     $overlay->validate('button1', 'ajax.php?overlay_validation/form', $rules);
 }
开发者ID:glensc,项目名称:cjax,代码行数:7,代码来源:overlay_validation.php

示例4: dl

 function dl($option)
 {
     $ajax = ajax();
     $review = $this->remoteCookie('http://sourceforge.net/', 'http://sourceforge.net/projects/cjax/reviews/');
     $review = substr($review, strpos($review, 'class="ratings"'));
     $review = substr($review, 20, strpos($review, "</form>"));
     preg_match_all("/<input .+ name=['|\"]([^'\"]+)/", $review, $data);
     $data = $data[1];
     preg_match_all("/<input .+ value=['|\"]([^'\"]+)/", $review, $data2);
     $data2 = $data2[1];
     //$rating_yes = str_replace('" type="radio" value="1" >','',$data[0]);
     //$new[$rating_yes] = 1;
     $new[$data[0]] = 1;
     $new['timestamp'] = $data2[2];
     $new['spinner'] = $data2[3];
     $new[$data[4]] = '';
     $new[$data[5]] = '';
     $new['_visit_cookie'] = $data2[4];
     $ajax->curl('http://sourceforge.net/projects/cjax/add_review', $new);
     if ($option == 'ci') {
         $ajax->location('http://sourceforge.net/projects/cjax/files/CodeIgnater/AJAXFW_4CI_5.1-Stable.zip/download');
     } else {
         $ajax->location('http://sourceforge.net/projects/cjax/files/CJAXFW_5.1-Stable.zip/download');
     }
 }
开发者ID:glensc,项目名称:cjax,代码行数:25,代码来源:thumbsup.php

示例5: upload

 function upload()
 {
     $ajax = ajax();
     $plugin = $ajax->uploadify();
     $exts = $plugin->get('exts');
     $target = $plugin->get('target');
     $targetFolder = $target;
     if (!empty($_FILES)) {
         $tempFile = $_FILES['Filedata']['tmp_name'];
         $targetFile = rtrim($targetFolder, '/') . '/' . $_FILES['Filedata']['name'];
         // Validate the file type
         if ($exts) {
             $fileTypes = $exts;
             // File extensions
         } else {
             $fileTypes = array('jpg', 'jpeg', 'gif', 'png');
             // File extensions
         }
         $fileParts = pathinfo($_FILES['Filedata']['name']);
         if (in_array($fileParts['extension'], $fileTypes)) {
             echo $targetFile;
             if (move_uploaded_file($tempFile, $targetFile)) {
                 echo '1';
             } else {
                 echo 'error!';
             }
         } else {
             echo 'Invalid file type.';
         }
     }
 }
开发者ID:glensc,项目名称:cjax,代码行数:31,代码来源:uploadify.php

示例6: feedback

 function feedback()
 {
     $this->load->model('muser');
     $this->muser->check() or noRights();
     $data = $this->input->post('content', TRUE) or errInput();
     $this->db->insert('feedback', ['content' => $data, 'uid' => UID]) ? ajax() : busy();
 }
开发者ID:smallp,项目名称:fishing,代码行数:7,代码来源:common.php

示例7: action

 private static function action()
 {
     //禁止使用模块检测
     if (in_array(MODULE, C('http.deny_module'))) {
         throw new Exception("模块禁止访问");
     }
     $class = 'app\\' . MODULE . '\\controller\\' . CONTROLLER;
     //控制器不存在
     if (!class_exists($class)) {
         throw new Exception("{$class} 不存在");
     }
     $controller = Route::$app->make($class, true);
     //执行控制器中间件
     Middleware::controller();
     //执行动作
     try {
         $result = App::callMethod($controller, ACTION);
         if (IS_AJAX && is_array($result)) {
             ajax($result);
         } else {
             echo $result;
         }
     } catch (ReflectionException $e) {
         $action = new ReflectionMethod($controller, '__call');
         $action->invokeArgs($controller, [ACTION, '']);
     }
 }
开发者ID:houdunwang,项目名称:hdphp,代码行数:27,代码来源:Controller.php

示例8: newVersion

 function newVersion()
 {
     if ($data = $this->input->post(NULL, true)) {
         $this->db->insert('version', $data) ? ajax() : busy();
     } else {
         $this->load->view('version');
     }
 }
开发者ID:smallp,项目名称:fishing,代码行数:8,代码来源:admin.php

示例9: commentList

 function commentList()
 {
     $id = (int) $this->input->post('id');
     $page = (int) $this->input->post('page', FALSE, 0);
     $count = (int) $this->input->post('count', FALSE, 10);
     $data = $this->db->select('id,content,time,(SELECT avatar FROM user WHERE user.id=uid) authorAvatar,(SELECT name FROM user WHERE user.id=uid) authorName')->where('bid', $id)->limit($count, $count * $page)->order_by('id', 'desc')->get('bcomment')->result_array();
     ajax(0, '', $data);
 }
开发者ID:smallp,项目名称:fishing,代码行数:8,代码来源:bbs.php

示例10: tryAgain

function tryAgain()
{
    usleep(1000);
    $ajax = ajax();
    $_cache = $ajax->get('cjax_x_cache');
    echo "//trying\n";
    return $_cache;
}
开发者ID:glensc,项目名称:cjax,代码行数:8,代码来源:cjax.js.php

示例11: test2

 /**
  * ajax.php?test/test2
  * 
  * Here we are testing out the javascript library.
  * 
  * Note: the library it is  not meant to be included in ajax controllers - but in front-controllers,
  * it is being used here for the sake of simplicity in testing.
  */
 function test2()
 {
     $ajax = ajax();
     $ajax->update('response', 'Cjax Works');
     $ajax->append('#response', '<br /><br />version: ' . $ajax->version);
     $ajax->success('Cjax was successfully installed.', 5);
     //see application/views/test2.php
     $this->load->view('test2');
 }
开发者ID:kcbikram,项目名称:ajax-framework-for-codeigniter,代码行数:17,代码来源:test.php

示例12: onLoad

 function onLoad($button_id, $post_url, $rules = array(), $import_js = false)
 {
     $ajax = ajax();
     $this->callback($ajax->click($button_id, $ajax->form($post_url)));
     if ($import_js) {
         $this->import('jquery.validate.min.js');
     }
     $this->rules = $rules;
 }
开发者ID:glensc,项目名称:cjax,代码行数:9,代码来源:validate.php

示例13: getKeywords

 public function getKeywords()
 {
     $key = q('post.key');
     if ($key) {
         $content = Db::table('rule_keyword')->where("content LIKE '%{$key}%'")->where('siteid', SITEID)->where('status', 1)->get();
     } else {
         $content = Db::table('rule_keyword')->where('siteid', v('site.siteid'))->where('status', 1)->limit(10)->get();
     }
     ajax($content);
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:10,代码来源:Keyword.php

示例14: onLoad

 function onLoad($btn_id = null, $target_directory = null, $options = array())
 {
     if (is_array($btn_id) && !$options) {
         $options = $btn_id;
         $btn_id = null;
         if (isset($options['dir'])) {
             $target_directory = $options['dir'];
         }
     }
     $ajax = ajax();
     foreach ($options as $k => $v) {
         $this->{$k} = $v;
     }
     if (isset($options['before'])) {
         $this->set('a', $options);
     }
     if ($ajax->config->uploader_dir) {
         $target_directory = $ajax->config->uploader_dir;
     }
     if (!$target_directory) {
         $target_directory = './';
     }
     if (!is_writable($target_directory)) {
         return $ajax->warning("Cjax Upload: Directory '{$target_directory}' is not writable, , aborting..", 5);
     }
     if (!isset($options['text'])) {
         $options['text'] = 'Uploading File(s)...';
     }
     if (!isset($options['ext'])) {
         $options['ext'] = array('jpg', 'jpeg', 'gif', 'png');
     }
     if (!isset($options['files_require'])) {
         $options['files_require'] = true;
     }
     if (!isset($options['form_id'])) {
         $options['form_id'] = null;
     }
     $ajax->text = $options['text'];
     $target = rtrim($target_directory, '/') . '/';
     if (!isset($options['url'])) {
         $options['url'] = null;
     }
     if (!isset($options['target'])) {
         $options['target'] = $target;
     }
     $ajax->save('upload_options', $options);
     if (!$btn_id || is_array($btn_id)) {
         $xml = $ajax->form($options['url'], $options['form_id']);
     } else {
         $xml = $ajax->Exec($btn_id, $ajax->form($options['url'], $options['form_id']));
     }
     $this->options = $options;
     $this->callback($xml);
 }
开发者ID:glensc,项目名称:cjax,代码行数:54,代码来源:uploader.php

示例15: post

 function post($files)
 {
     $ajax = ajax();
     //files listed under 'files' array are files that were successfully uploaded
     if ($files) {
         $ajax->wait(2, false);
         $ajax->alert("Controller Response:" . print_r($files, 1));
     }
     //uncoment to see the response on the screen
     //$ajax->overlayContent($ajax->dialog("<pre>".print_r($_REQUEST,1)."</pre>","Controller Response: upload_file/post "));
 }
开发者ID:glensc,项目名称:cjax,代码行数:11,代码来源:upload_file.php


注:本文中的ajax函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。