Redaxscript\Request::getCookie PHP Method

getCookie() public method

get item from cookie
Since: 2.2.0
public getCookie ( string $key = null ) : string
$key string key of the item
return string
    public function getCookie($key = null)
    {
        return self::get($key, 'cookie');
    }

Usage Example

Example #1
0
 /**
  * testCookie
  *
  * @since 2.2.0
  */
 public function testCookie()
 {
     /* setup */
     Request::setCookie('testKey', 'testValue');
     /* result */
     $result = Request::getCookie('testKey');
     /* compare */
     $this->assertEquals('testValue', $result);
 }