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


PHP Application::DELETE方法代码示例

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


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

示例1: 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

示例2: function

});
// 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
$app->GET('/subcategories', function (Application $app, Request $request) {
    $handler = new SubcategoryHandler();
    $result = $handler->getAll();
    return new Response($result, 200);
});
// Get subcategories by categories
$app->GET('/subcategories/category/{category_id}', function (Application $app, Request $request, $category_id) {
    $handler = new SubcategoryHandler();
    $result = $handler->getByCategory($category_id);
    return new Response($result, 200);
开发者ID:fitzsimk,项目名称:Reuse-and-Repair,代码行数:32,代码来源:index.php

示例3: Response

    $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 ?');
});
$app->POST('/order/cancelAllAfter', function (Application $app, Request $request) {
    $timeout = $request->get('timeout');
    return new Response('How about implementing order.cancelAllAfter as a POST method ?');
});
$app->POST('/order/closePosition', function (Application $app, Request $request) {
    $symbol = $request->get('symbol');
    $price = $request->get('price');
开发者ID:vladmelnyk,项目名称:api-connectors,代码行数:32,代码来源:index.php


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