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


PHP REST::requireRequestMethod方法代码示例

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


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

示例1: getEntities

 public function getEntities()
 {
     REST::requireRequestMethod('GET');
     $db = new MySQL();
     $entitiesNode = new XMLNode('entities');
     foreach (Model::getEntities() as $entity) {
         $entityNode = new XMLNode('entity');
         $entityNode->setAttribute('identifier', $entity['IDENTIFIER']);
         $entityNode->setAttribute('friendlyname', $entity['FRIENDLYNAME']);
         $entityNode->setAttribute('lat', $entity['LATITUDE']);
         $entityNode->setAttribute('lon', $entity['LONGITUDE']);
         $entityNode->setAttribute('date', strtotime($entity['DATETIME']));
         $entitiesNode->addNode($entityNode);
     }
     $xmlDoc = new XMLDocument();
     $xmlDoc->setRootNode($entitiesNode);
     REST::sendResponse(200, $xmlDoc, 'application/xml');
 }
开发者ID:BGCX261,项目名称:zonetrak-svn-to-git,代码行数:18,代码来源:entities.class.php

示例2: getTileUrl

 public function getTileUrl()
 {
     REST::requireRequestMethod('GET');
     $requiredParameters = array('lat', 'lon', 'zoom');
     if (Util::isValid($requiredParameters, $values, $this->params)) {
         extract($values);
         $url = "http://tile.openstreetmap.org/" . Map::getTileNumber($lat, $lon, $zoom) . ".png";
         $urlNode = new XMLNode('url');
         $urlNode->setAttribute('href', $url);
         $mapNode = new XMLNode('map');
         $mapNode->setAttributes($values);
         $mapNode->addNode($urlNode);
         $xmlDoc = new XMLDocument();
         $xmlDoc->setRootNode($mapNode);
         REST::sendResponse(200, $xmlDoc, 'application/xml');
     } else {
         REST::sendResponse(400);
     }
 }
开发者ID:BGCX261,项目名称:zonetrak-svn-to-git,代码行数:19,代码来源:map.class.php

示例3: getZones

 public function getZones()
 {
     REST::requireRequestMethod('GET');
     $zonesNode = new XMLNode('zones');
     foreach (Model::getZones() as $zone) {
         $zoneNode = new XMLNode('zone');
         $zoneNode->setAttribute('id', $zone['ID']);
         $zoneNode->setAttribute('type', $zone['TYPE']);
         $zoneNode->setAttribute('date', strtotime($zone['CREATED_ON']));
         $zoneNode->setAttribute('deleted', $zone['DELETED_ON'] != '0000-00-00 00:00:00' ? 'true' : 'false');
         $waypointsNode = new XMLNode('waypoints');
         foreach (Model::getWaypoints($zone['ID']) as $waypoint) {
             $waypointNode = new XMLNode('waypoint');
             $waypointNode->setAttribute('latitude', $waypoint['LATITUDE']);
             $waypointNode->setAttribute('longitude', $waypoint['LONGITUDE']);
             $waypointsNode->addNode($waypointNode);
         }
         $zoneNode->addNode($waypointsNode);
         $zonesNode->addNode($zoneNode);
     }
     $xmlDoc = new XMLDocument();
     $xmlDoc->setRootNode($zonesNode);
     REST::sendResponse(200, $xmlDoc, 'application/xml');
 }
开发者ID:BGCX261,项目名称:zonetrak-svn-to-git,代码行数:24,代码来源:zones.class.php


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