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


PHP Helpers::isAjax方法代码示例

本文整理汇总了PHP中Helpers::isAjax方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::isAjax方法的具体用法?PHP Helpers::isAjax怎么用?PHP Helpers::isAjax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helpers的用法示例。


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

示例1: render

 /**
  * Renders blue screen.
  * @param  \Exception|\Throwable
  * @return void
  */
 public function render($exception)
 {
     if (Helpers::isAjax() && session_status() === PHP_SESSION_ACTIVE) {
         ob_start(function () {
         });
         $this->renderTemplate($exception, __DIR__ . '/assets/BlueScreen/content.phtml');
         $contentId = $_SERVER['HTTP_X_TRACY_AJAX'];
         $_SESSION['_tracy']['bluescreen'][$contentId] = ['content' => ob_get_clean(), 'dumps' => Dumper::fetchLiveData(), 'time' => time()];
     } else {
         $this->renderTemplate($exception, __DIR__ . '/assets/BlueScreen/page.phtml');
     }
 }
开发者ID:assad2012,项目名称:My_CodeIgniter,代码行数:17,代码来源:BlueScreen.php

示例2: Db

 *  - but more importantly it will work for search engines. Then we initialise the widget and hide the now
 * useless pagination links at the bottom of the page.
 */
require_once __DIR__ . '/helpers.php';
$pages = 15;
$pageSize = 40;
$db = new Db($pages, $pageSize);
$page = isset($_GET['p']) ? (int) $_GET['p'] : 1;
try {
    $db->setCurrentPage($page);
} catch (RangeException $e) {
    header('Location: ' . $_SERVER['PHP_SELF']);
    exit;
}
$items = $db->getItemsAtPage();
if (Helpers::isAjax()) {
    Helpers::sendJson(['items' => $items]);
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Nittro Paginator widget example</title>

        <script type="application/json" id="nittro-params">
            {
                "basePath": "/examples",
                "page": {
                    "whitelistLinks": true
                }
开发者ID:nittro,项目名称:nittro,代码行数:31,代码来源:paginator-ondemand.php

示例3: dispatchAssets

 /**
  * Renders debug bar assets.
  * @return bool
  */
 public function dispatchAssets()
 {
     $asset = isset($_GET['_tracy_bar']) ? $_GET['_tracy_bar'] : NULL;
     if ($asset === 'js') {
         header('Content-Type: text/javascript');
         header('Cache-Control: max-age=864000');
         header_remove('Pragma');
         header_remove('Set-Cookie');
         $this->renderAssets();
         return TRUE;
     }
     $this->useSession = session_status() === PHP_SESSION_ACTIVE;
     if ($this->useSession && Helpers::isAjax()) {
         header('X-Tracy-Ajax: 1');
         // session must be already locked
     }
     if ($this->useSession && preg_match('#^content(-ajax)?.(\\w+)$#', $asset, $m)) {
         $session =& $_SESSION['_tracy']['bar'][$m[2] . $m[1]];
         header('Content-Type: text/javascript');
         header('Cache-Control: max-age=60');
         header_remove('Set-Cookie');
         if (!$m[1]) {
             $this->renderAssets();
         }
         if ($session) {
             $method = $m[1] ? 'loadAjax' : 'init';
             echo "Tracy.Debug.{$method}(", json_encode($session['content']), ', ', json_encode($session['dumps']), ');';
             $session = NULL;
         }
         $session =& $_SESSION['_tracy']['bluescreen'][$m[2]];
         if ($session) {
             echo "Tracy.BlueScreen.loadAjax(", json_encode($session['content']), ', ', json_encode($session['dumps']), ');';
             $session = NULL;
         }
         return TRUE;
     }
 }
开发者ID:assad2012,项目名称:My_CodeIgniter,代码行数:41,代码来源:Bar.php

示例4: dispatchContent

 /**
  * Renders debug bar content.
  * @return bool
  */
 public function dispatchContent()
 {
     $this->dispatched = TRUE;
     if (Helpers::isAjax()) {
         header('X-Tracy-Ajax: 1');
         // session must be already locked
     }
     if (preg_match('#^content(-ajax)?.(\\w+)$#', isset($_GET['_tracy_bar']) ? $_GET['_tracy_bar'] : '', $m)) {
         $session =& $_SESSION['_tracy']['bar'][$m[2] . $m[1]];
         header('Content-Type: text/javascript');
         header('Cache-Control: max-age=60');
         header_remove('Set-Cookie');
         if ($session) {
             $method = $m[1] ? 'loadAjax' : 'init';
             echo "Tracy.Debug.{$method}(", json_encode($session['content']), ', ', json_encode($session['dumps']), ');';
             $session = NULL;
         }
         $session =& $_SESSION['_tracy']['bluescreen'][$m[2]];
         if ($session) {
             echo "Tracy.BlueScreen.loadAjax(", json_encode($session['content']), ', ', json_encode($session['dumps']), ');';
             $session = NULL;
         }
         return TRUE;
     }
 }
开发者ID:manGoweb,项目名称:mnamGo,代码行数:29,代码来源:Bar.php


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