當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。