Пример #1
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : false;
     $this->headers = $this->loadHttpHeaders();
     $this->body = @file_get_contents('php://input');
     $this->get = self::stripSlashesIfMagicQuotes($_GET);
     $this->post = self::stripSlashesIfMagicQuotes($_POST);
     $this->put = self::stripSlashesIfMagicQuotes($this->loadPutParameters());
     $this->cookies = self::stripSlashesIfMagicQuotes($_COOKIE);
     $this->root = Slim_Http_Uri::getBaseUri(true);
     $this->resource = Slim_Http_Uri::getUri(true);
     $this->checkForHttpMethodOverride();
 }
Пример #2
0
 /**
  * Test URIs if SERVER[REQUEST_URI] is not available (ie. IIS)
  */
 public function testUrisIfNoRequestUri() {
     unset($_SERVER['REQUEST_URI']);
     //With htaccess
     $_SERVER['PHP_SELF'] = '/foo/one/two';
     $_SERVER['SCRIPT_NAME'] = '/foo/bootstrap.php';
     $this->assertEquals('/foo', Slim_Http_Uri::getBaseUri(true));
     $this->assertEquals('/one/two', Slim_Http_Uri::getUri(true));
     //Without htaccess
     $_SERVER['PHP_SELF'] = '/foo/bootstrap.php/one/two';
     $_SERVER['SCRIPT_NAME'] = '/foo/bootstrap.php';
     $this->assertEquals('/foo/bootstrap.php', Slim_Http_Uri::getBaseUri(true));
     $this->assertEquals('/one/two', Slim_Http_Uri::getUri(true));
 }
Пример #3
0
 /**
  * Get URI Query String
  *
  * @return string
  */
 public static function getQueryString($reload = false)
 {
     if ($reload || is_null(self::$queryString)) {
         self::$queryString = $_SERVER['QUERY_STRING'];
     }
     return self::$queryString;
 }
Пример #4
0
 /**
  * Test query string
  */
 public function testQueryString()
 {
     $_SERVER['QUERY_STRING'] = 'foo=bar&one=1';
     $this->assertEquals('foo=bar&one=1', Slim_Http_Uri::getQueryString());
 }