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


PHP RequestHandler::responseMode方法代码示例

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


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

示例1: respondLoginPrompt

 /**
  * Print login page and exit
  * @return nothing
  * @param object $AuthException[optional]
  */
 public function respondLoginPrompt($authException = false)
 {
     if (Site::$pathStack[0] == 'json' || $_REQUEST['format'] == 'json' || $_SERVER['HTTP_ACCEPT'] == 'application/json') {
         RequestHandler::$responseMode = 'json';
     }
     header('HTTP/1.1 401 Unauthorized');
     $postVars = $_POST;
     unset($postVars[static::$requestContainer]);
     RequestHandler::respond('login/login', array('success' => false, 'loginRequired' => true, 'requestContainer' => static::$requestContainer, 'error' => $authException ? $authException->getMessage() : false, 'postVars' => $postVars));
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:15,代码来源:PasswordAuthenticator.class.php

示例2: array

<?php

RequestHandler::$responseMode = 'csv';
RequestHandler::respond('projects', array('data' => array_map(function ($Project) {
    preg_match('/^\\s*[^*#]\\s*\\w.*/m', $Project->README, $matches);
    return array('name' => $Project->Title, 'description' => trim($matches[0]), 'link_url' => $Project->UsersUrl, 'code_url' => $Project->DevelopersUrl, 'type' => '', 'categories' => implode(', ', array_map(function ($Tag) {
        return $Tag->UnprefixedTitle;
    }, array_filter($Project->Tags, function ($Tag) {
        return $Tag->Prefix == 'topic';
    }))));
}, Laddr\Project::getAll())));
开发者ID:Sun-Wukong,项目名称:laddr,代码行数:11,代码来源:projects.csv.php

示例3: EmergenceSyncer

<?php

$GLOBALS['Session']->requireAccountLevel('Developer');
set_time_limit(0);
RequestHandler::$responseMode = 'json';
if (empty($_REQUEST['path'])) {
    RequestHandler::throwError('path required');
}
if (empty($_REQUEST['host'])) {
    RequestHandler::throwError('host required');
}
if (!($sourceCollection = Site::resolvePath($_REQUEST['path']))) {
    RequestHandler::throwError('path not found locally');
}
// create stream context for remote server
$syncer = new EmergenceSyncer(array('host' => $_REQUEST['host'], 'authUsername' => $_SERVER['PHP_AUTH_USER'], 'authPassword' => $_SERVER['PHP_AUTH_PW']));
$diff = $syncer->diffCollection($sourceCollection, !empty($_REQUEST['deep']));
if (empty($_REQUEST['push'])) {
    RequestHandler::respond('diff', array('diff' => $diff));
} else {
    $result = $syncer->pushDiff($diff);
    RequestHandler::respond('pushComplete', array('result' => $result));
}
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:23,代码来源:emergence-push.php


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