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


PHP request::getOperation方法代码示例

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


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

示例1: testApiDelete

 public function testApiDelete()
 {
     $this->reset();
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
     $_SERVER['QUERY_STRING'] = 'foo';
     $_POST['deletetoken'] = 'bar';
     $request = new request();
     $this->assertTrue($request->isJsonApiCall(), 'is JSON Api call');
     $this->assertEquals('delete', $request->getOperation());
     $this->assertEquals('foo', $request->getParam('pasteid'));
     $this->assertEquals('bar', $request->getParam('deletetoken'));
 }
开发者ID:danesjenovdan,项目名称:DJNBin,代码行数:13,代码来源:request.php

示例2: __construct

 /**
  * constructor
  *
  * initializes and runs ZeroBin
  *
  * @access public
  * @return void
  */
 public function __construct()
 {
     if (version_compare(PHP_VERSION, '5.2.6') < 0) {
         throw new Exception(i18n::_('ZeroBin requires php 5.2.6 or above to work. Sorry.'), 1);
     }
     // load config from ini file
     $this->_init();
     switch ($this->_request->getOperation()) {
         case 'create':
             $this->_create();
             break;
         case 'delete':
             $this->_delete($this->_request->getParam('pasteid'), $this->_request->getParam('deletetoken'));
             break;
         case 'read':
             $this->_read($this->_request->getParam('pasteid'));
             break;
         case 'jsonld':
             $this->_jsonld($this->_request->getParam('jsonld'));
             return;
     }
     // output JSON or HTML
     if ($this->_request->isJsonApiCall()) {
         header('Content-type: application/json');
         header('Access-Control-Allow-Origin: *');
         header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
         header('Access-Control-Allow-Headers: X-Requested-With, Content-Type');
         echo $this->_json;
     } else {
         $this->_view();
     }
 }
开发者ID:squarefractal,项目名称:ZeroBin,代码行数:40,代码来源:zerobin.php

示例3: __construct

 /**
  * constructor
  *
  * initializes and runs PrivateBin
  *
  * @access public
  * @throws Exception
  * @return void
  */
 public function __construct()
 {
     if (version_compare(PHP_VERSION, '5.3.0') < 0) {
         throw new Exception(I18n::_('PrivateBin requires php 5.3.0 or above to work. Sorry.'), 1);
     }
     if (strlen(PATH) < 0 && substr(PATH, -1) !== DIRECTORY_SEPARATOR) {
         throw new Exception(I18n::_('PrivateBin requires the PATH to end in a "%s". Please update the PATH in your index.php.', DIRECTORY_SEPARATOR), 5);
     }
     // load config from ini file, initialize required classes
     $this->_init();
     switch ($this->_request->getOperation()) {
         case 'create':
             $this->_create();
             break;
         case 'delete':
             $this->_delete($this->_request->getParam('pasteid'), $this->_request->getParam('deletetoken'));
             break;
         case 'read':
             $this->_read($this->_request->getParam('pasteid'));
             break;
         case 'jsonld':
             $this->_jsonld($this->_request->getParam('jsonld'));
             return;
     }
     // output JSON or HTML
     if ($this->_request->isJsonApiCall()) {
         header('Content-type: ' . Request::MIME_JSON);
         header('Access-Control-Allow-Origin: *');
         header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
         header('Access-Control-Allow-Headers: X-Requested-With, Content-Type');
         echo $this->_json;
     } else {
         $this->_view();
     }
 }
开发者ID:privatebin,项目名称:privatebin,代码行数:44,代码来源:PrivateBin.php


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