當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Response::responseWithSuccess方法代碼示例

本文整理匯總了PHP中Response::responseWithSuccess方法的典型用法代碼示例。如果您正苦於以下問題:PHP Response::responseWithSuccess方法的具體用法?PHP Response::responseWithSuccess怎麽用?PHP Response::responseWithSuccess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Response的用法示例。


在下文中一共展示了Response::responseWithSuccess方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: function

<?php

$app['controllers']['tag/getall'] = function ($app, $request) {
    $idProject = !empty($request['id_project']) ? (int) $request['id_project'] : null;
    if (!is_null($idProject)) {
        $tags = $app['bugmanager']->getAllTagsFromProject($idProject);
        Response::responseWithSuccess(['tags' => $tags]);
    } else {
        Response::responseWithError($app['i18n']['errors']['empty_id_project']);
    }
};
開發者ID:serkin,項目名稱:bugmanager,代碼行數:11,代碼來源:getall.php

示例2: function

<?php

$app['controllers']['tag/setstatus'] = function ($app, $request) {
    $idTag = !empty($request['id_tag']) ? $request['id_tag'] : null;
    $status = !empty($request['status']) ? $request['status'] : null;
    if (empty($status)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_tag_status'];
    } elseif (empty($idTag)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_id_tag'];
    } else {
        $result = $app['bugmanager']->setTagStatus($idTag, $status);
        $errorMsg = $app['i18n']['errors']['cannot_update_tag_status'];
    }
    if ($result) {
        Response::responseWithSuccess([], $app['i18n']['bugmanager']['tag_status_updated']);
    } else {
        Response::responseWithError($errorMsg);
    }
};
開發者ID:serkin,項目名稱:bugmanager,代碼行數:21,代碼來源:setstatus.php

示例3: function

<?php

$app['controllers']['project/save'] = function ($app, $request) {
    parse_str($request['form'], $form);
    $idProject = !empty($form['id_project']) ? $form['id_project'] : null;
    if (empty($form['name'])) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_project_name'];
    } else {
        $result = $app['bugmanager']->saveProject($form['name'], $idProject);
        $error = $app['bugmanager']->getError();
        $errorMsg = $error[2];
    }
    if ($result) {
        Response::responseWithSuccess(['id_project' => $result], $app['i18n']['bugmanager']['project_saved']);
    } else {
        Response::responseWithError($errorMsg);
    }
};
開發者ID:serkin,項目名稱:bugmanager,代碼行數:19,代碼來源:save.php

示例4: function

<?php

$app['controllers']['issue/getone'] = function ($app, $request) {
    $idProject = !empty($request['id_project']) ? $request['id_project'] : null;
    $idIssue = !empty($request['id_issue']) ? $request['id_issue'] : null;
    $result = true;
    $response = [];
    $response['issue_types'] = $app['config']['issue_types'];
    if (empty($idProject)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_id_project'];
    }
    $response['tags'] = !empty($idProject) ? $app['bugmanager']->getAllTagsFromProject($idProject) : [];
    $response['issue'] = !empty($idIssue) ? $app['bugmanager']->getIssue($idIssue) : [];
    if ($result) {
        Response::responseWithSuccess($response);
    } else {
        Response::responseWithError($errorMsg);
    }
};
開發者ID:serkin,項目名稱:bugmanager,代碼行數:20,代碼來源:getone.php

示例5: function

<?php

$app['controllers']['tag/delete'] = function ($app, $request) {
    $idTag = !empty($request['id_tag']) ? $request['id_tag'] : null;
    if (empty($idTag)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_id_tag'];
    } else {
        $result = $app['bugmanager']->deleteTag($idTag);
        $error = $app['bugmanager']->getError();
        $errorMsg = $error[2];
    }
    if ($result) {
        Response::responseWithSuccess([], $app['i18n']['bugmanager']['tag_removed']);
    } else {
        Response::responseWithError($errorMsg);
    }
};
開發者ID:serkin,項目名稱:bugmanager,代碼行數:18,代碼來源:delete.php

示例6: parse_str

    parse_str(urldecode($request['form']), $form);
    $idProject = !empty($form['id_project']) ? $form['id_project'] : null;
    $code = !empty($form['code']) ? $form['code'] : null;
    $arr = !empty($form['translation']) ? $form['translation'] : array();
    if (empty($idProject)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_id_project'];
    } elseif (empty($code) || $isCodeValid($code) === false) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['not_valid_project_code'];
    } else {
        $result = $app['foler']->saveTranslation($idProject, $code, $arr);
        $errorMsg = $app['foler']->getError();
    }
    if ($result) {
        Response::responseWithSuccess(array(), $app['i18n']['foler']['translation_saved']);
    } else {
        Response::responseWithError($errorMsg);
    }
};
// Source: config/footer.php
$app['foler'] = new Foler($app['config']['db']['dsn'], $app['config']['db']['user'], $app['config']['db']['password'], $app['i18n']);
try {
    $app['foler']->connect();
} catch (Exception $exc) {
    Response::responseWithError($exc->getMessage());
}
$i18n = $app['i18n'] = $app['i18n'][$app['locale']];
if (!empty($_REQUEST['action']) && isset($app['controllers'][$_REQUEST['action']])) {
    $app['controllers'][$_REQUEST['action']]($app, $_REQUEST);
    die;
開發者ID:serkin,項目名稱:foler,代碼行數:31,代碼來源:foler.php


注:本文中的Response::responseWithSuccess方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。