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


PHP Application::GET方法代码示例

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


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

示例1: function

require '../server/BusinessHandler.php';
require '../server/AdminHandler.php';
require '../server/Authentication.php';
require '../server/password.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Silex\Application;
$app = new Silex\Application();
$app['debug'] = true;
$app->after(function (Request $request, Response $response) {
    $response->headers->set('Access-Control-Allow-Origin', '*');
    // echo $response->headers;
});
// 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'));
开发者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: 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->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');
    $get_favorites = $request->get('get_favorites');
    return new Response('How about implementing devicelist as a GET method ?');
});
$app->GET('/api/getmeasure', function (Application $app, Request $request) {
    $access_token = $request->get('access_token');
    $device_id = $request->get('device_id');
    $module_id = $request->get('module_id');
    $scale = $request->get('scale');
    $type = $request->get('type');
    $date_begin = $request->get('date_begin');
    $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 ?');
});
开发者ID:wep4you,项目名称:netatmo-swagger-api,代码行数:31,代码来源:index.php

示例4: 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->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');
开发者ID:vladmelnyk,项目名称:api-connectors,代码行数:31,代码来源:index.php


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