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


PHP Application::POST方法代码示例

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


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

示例1: function

});
// 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) {
    if (!authenticate('2', null)) {
        return new Response('Unauthorized', 401);
    }
    $handler = new CategoryHandler();
    $result = $handler->delete($category_id);
    return new Response($result['message'], $result['status_code']);
});
// Subcategory routes
// All subcategories
开发者ID:fitzsimk,项目名称:Reuse-and-Repair,代码行数:31,代码来源:index.php

示例2: function

<?php

require_once __DIR__ . '/vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Silex\Application;
$app = new Silex\Application();
$app->POST('/v2/pet', function (Application $app, Request $request) {
    return new Response('How about implementing addPet as a POST method ?');
});
$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 ?');
开发者ID:ModelSolv,项目名称:swagger-codegen,代码行数:31,代码来源:index.php

示例3: Response

    $date_end = $request->get('date_end');
    $limit = $request->get('limit');
    $optimize = $request->get('optimize');
    $real_time = $request->get('real_time');
    return new Response('How about implementing getmeasure as a GET method ?');
});
$app->GET('/api/getuser', function (Application $app, Request $request) {
    $access_token = $request->get('access_token');
    return new Response('How about implementing getuser as a GET method ?');
});
$app->POST('/oauth2/token', function (Application $app, Request $request) {
    $grant_type = $request->get('grant_type');
    $client_id = $request->get('client_id');
    $client_secret = $request->get('client_secret');
    $scope = $request->get('scope');
    $username = $request->get('username');
    $password = $request->get('password');
    $code = $request->get('code');
    $redirect_uri = $request->get('redirect_uri');
    $refresh_token = $request->get('refresh_token');
    return new Response('How about implementing getToken as a POST method ?');
});
$app->POST('/api/createnewschedule', function (Application $app, Request $request) {
    $access_token = $request->get('access_token');
    $device_id = $request->get('device_id');
    $module_id = $request->get('module_id');
    return new Response('How about implementing createnewschedule as a POST method ?');
});
$app->GET('/api/devicelist', function (Application $app, Request $request) {
    $access_token = $request->get('access_token');
    $app_type = $request->get('app_type');
    $device_id = $request->get('device_id');
开发者ID:wep4you,项目名称:netatmo-swagger-api,代码行数:32,代码来源:index.php

示例4: function

$app->GET('/order', function (Application $app, Request $request) {
    $symbol = $request->get('symbol');
    $filter = $request->get('filter');
    $columns = $request->get('columns');
    $count = $request->get('count');
    $start = $request->get('start');
    $reverse = $request->get('reverse');
    $start_time = $request->get('start_time');
    $end_time = $request->get('end_time');
    return new Response('How about implementing order.getOrders as a GET method ?');
});
$app->POST('/order', function (Application $app, Request $request) {
    $symbol = $request->get('symbol');
    $quantity = $request->get('quantity');
    $price = $request->get('price');
    $time_in_force = $request->get('time_in_force');
    $type = $request->get('type');
    $stop_price = $request->get('stop_price');
    $cl_ord_id = $request->get('cl_ord_id');
    return new Response('How about implementing order.newOrder as a POST method ?');
});
$app->DELETE('/order', function (Application $app, Request $request) {
    $order_id = $request->get('order_id');
    $cl_ord_id = $request->get('cl_ord_id');
    $text = $request->get('text');
    return new Response('How about implementing order.cancelOrder as a DELETE method ?');
});
$app->DELETE('/order/all', function (Application $app, Request $request) {
    $symbol = $request->get('symbol');
    $filter = $request->get('filter');
    $text = $request->get('text');
    return new Response('How about implementing order.cancelAll as a DELETE method ?');
开发者ID:vladmelnyk,项目名称:api-connectors,代码行数:32,代码来源:index.php


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