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


PHP Application::PUT方法代碼示例

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


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

示例1: function

$app->DELETE('/v2/pet/{petId}', function (Application $app, Request $request, $pet_id) {
    return new Response('How about implementing deletePet as a DELETE method ?');
});
$app->GET('/v2/pet/findByStatus', function (Application $app, Request $request) {
    $status = $request->get('status');
    return new Response('How about implementing findPetsByStatus as a GET method ?');
});
$app->GET('/v2/pet/findByTags', function (Application $app, Request $request) {
    $tags = $request->get('tags');
    return new Response('How about implementing findPetsByTags as a GET method ?');
});
$app->GET('/v2/pet/{petId}', function (Application $app, Request $request, $pet_id) {
    return new Response('How about implementing getPetById as a GET method ?');
});
$app->PUT('/v2/pet', function (Application $app, Request $request) {
    return new Response('How about implementing updatePet as a PUT method ?');
});
$app->POST('/v2/pet/{petId}', function (Application $app, Request $request, $pet_id) {
    $name = $request->get('name');
    $status = $request->get('status');
    return new Response('How about implementing updatePetWithForm as a POST method ?');
});
$app->POST('/v2/pet/{petId}/uploadImage', function (Application $app, Request $request, $pet_id) {
    $additional_metadata = $request->get('additional_metadata');
    $file = $request->get('file');
    return new Response('How about implementing uploadFile as a POST method ?');
});
$app->DELETE('/v2/store/order/{orderId}', function (Application $app, Request $request, $order_id) {
    return new Response('How about implementing deleteOrder as a DELETE method ?');
});
$app->GET('/v2/store/inventory', function (Application $app, Request $request) {
開發者ID:ModelSolv,項目名稱:swagger-codegen,代碼行數:31,代碼來源:index.php

示例2: function

// Request::setTrustedProxies(array($ip));
$app->GET('/', function (Application $app, Request $request) {
    return new Response("<p>All good!</p>", 200);
});
// Category Routes
// All categories
$app->GET('/categories', function (Application $app, Request $request) {
    $handler = new CategoryHandler();
    $result = $handler->getAll();
    return new Response($result, 200);
});
// Create category
$app->PUT('/categories', function (Application $app, Request $request) {
    if (!authenticate('2', null)) {
        return new Response('Unauthorized', 401);
    }
    $handler = new CategoryHandler();
    $result = $handler->add($request->get('category_name'));
    return new Response($result['message'], $result['status_code']);
});
// Update category
$app->POST('/categories/{category_id}', function (Application $app, Request $request, $category_id) {
    if (!authenticate('2', null)) {
        return new Response('Unauthorized', 401);
    }
    $object = array('category_id' => $category_id, 'new_category' => $request->get('category_name'));
    $handler = new CategoryHandler();
    $result = $handler->update($object);
    return new Response($result['message'], $result['status_code']);
});
// Destroy category
$app->DELETE('/categories/{category_id}', function (Application $app, Request $request, $category_id) {
開發者ID:fitzsimk,項目名稱:Reuse-and-Repair,代碼行數:32,代碼來源:index.php

示例3: function

$app->POST('/apiKey/disable', function (Application $app, Request $request) {
    $api_key_id = $request->get('api_key_id');
    return new Response('How about implementing apiKey.disable as a POST method ?');
});
$app->POST('/apiKey/enable', function (Application $app, Request $request) {
    $api_key_id = $request->get('api_key_id');
    return new Response('How about implementing apiKey.enable as a POST method ?');
});
$app->GET('/user', function (Application $app, Request $request) {
    return new Response('How about implementing user.getMe as a GET method ?');
});
$app->PUT('/user', function (Application $app, Request $request) {
    $firstname = $request->get('firstname');
    $lastname = $request->get('lastname');
    $old_password = $request->get('old_password');
    $new_password = $request->get('new_password');
    $new_password_confirm = $request->get('new_password_confirm');
    $country = $request->get('country');
    $pgp_pub_key = $request->get('pgp_pub_key');
    return new Response('How about implementing user.updateMe as a PUT method ?');
});
$app->POST('/user', function (Application $app, Request $request) {
    $email = $request->get('email');
    $password = $request->get('password');
    $username = $request->get('username');
    $firstname = $request->get('firstname');
    $lastname = $request->get('lastname');
    $accepts_tos = $request->get('accepts_tos');
    $referrer_id = $request->get('referrer_id');
    $country = $request->get('country');
    return new Response('How about implementing user.newUser as a POST method ?');
});
開發者ID:vladmelnyk,項目名稱:api-connectors,代碼行數:32,代碼來源:index.php


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