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


PHP AjaxResponse::setResponseCode方法代码示例

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


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

示例1: WMU

function WMU()
{
    global $wgRequest, $wgGroupPermissions, $wgAllowCopyUploads;
    // Overwrite configuration settings needed by image import functionality
    $wgAllowCopyUploads = true;
    $wgGroupPermissions['user']['upload_by_url'] = true;
    $dir = dirname(__FILE__) . '/';
    require_once $dir . 'WikiaMiniUpload_body.php';
    $method = $wgRequest->getVal('method');
    $wmu = new WikiaMiniUpload();
    if (method_exists($wmu, $method)) {
        $html = $wmu->{$method}();
        $ar = new AjaxResponse($html);
        $ar->setContentType('text/html; charset=utf-8');
    } else {
        $errorMessage = 'WMU::' . $method . ' does not exist';
        \Wikia\Logger\WikiaLogger::instance()->error($errorMessage);
        $payload = json_encode(['message' => $errorMessage]);
        $ar = new AjaxResponse($payload);
        $ar->setResponseCode('501 Not implemented');
        $ar->setContentType('application/json; charset=utf-8');
    }
    return $ar;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:24,代码来源:WikiaMiniUpload_setup.php

示例2: returnMsg

 /**
  * Returns the JSON message
  */
 protected static function returnMsg($code, $state)
 {
     $msgId = self::NAME . '-' . ($state ? 'unprotect' : 'protect');
     $response = array('code' => $code, 'msg' => self::translateCode($code), 'state' => $state, 'text' => wfMsg($msgId));
     $result = self::SimpleJsonEncode($response);
     $ajaxResponse = new AjaxResponse($result);
     $ajaxResponse->setContentType('application/json');
     $ajaxResponse->setResponseCode(self::$codeHttpMap[$code]);
     return $ajaxResponse;
 }
开发者ID:clrh,项目名称:mediawiki,代码行数:13,代码来源:QuickEditProtect.php

示例3: smwf_tb_getTripleStoreStatus

function smwf_tb_getTripleStoreStatus()
{
    global $smwgTripleStoreGraph;
    $con = TSConnection::getConnector();
    try {
        $con->connect();
        $statusInfo = $con->getStatus($smwgTripleStoreGraph);
        $response = new AjaxResponse(json_encode($statusInfo));
        $response->setContentType("application/json");
        $response->setResponseCode(200);
        $con->disconnect();
    } catch (Exception $e) {
        $response = new AjaxResponse($e->getMessage());
        $response->setContentType("application/text");
        $response->setResponseCode(500);
    }
    return $response;
}
开发者ID:seedbank,项目名称:old-repo,代码行数:18,代码来源:SMW_ToolbarFunctions.php

示例4: playerAjaxHandler

function playerAjaxHandler($file, $options)
{
    $response = new AjaxResponse();
    try {
        #TODO: caching!
        $player = Player::newFromName($file, $options, 'thumbsize');
        $html = $player->getPlayerHTML();
        $response->addText($html);
    } catch (PlayerException $ex) {
        $response->setResponseCode($ex->getHTTPCode());
        $response->addText($ex->getHTML());
    }
    return $response;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:Player.php

示例5: wfAjaxPostCollection

function wfAjaxPostCollection($collection = '', $redirect = '')
{
    $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
    if (session_id() == '') {
        wfSetupSession();
    }
    $collection = $json->decode($collection);
    $collection['enabled'] = true;
    $_SESSION['wsCollection'] = $collection;
    $r = new AjaxResponse();
    if ($redirect) {
        $title = Title::newFromText($redirect);
        $redirecturl = wfExpandUrl($title->getFullURL(), PROTO_CURRENT);
        $r->setResponseCode(302);
        header('Location: ' . $redirecturl);
    } else {
        $title = SpecialPage::getTitleFor('Book');
        $redirecturl = wfExpandUrl($title->getFullURL(), PROTO_CURRENT);
        $r->setContentType('application/json');
        $r->addText($json->encode(array('redirect_url' => $redirecturl)));
    }
    return $r;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:23,代码来源:Collection.php


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