r::set PHP Method

set() static public method

Sets a request value by key
static public set ( mixed $key, mixed $value = null )
$key mixed The key to define
$value mixed The value for the passed key
    static function set($key, $value = null)
    {
        $data = self::data();
        if (is_array($key)) {
            self::$_ = array_merge($data, $key);
        } else {
            self::$_[$key] = $value;
        }
    }

Usage Example

示例#1
0
 public function testSet()
 {
     r::set('testvar', 'testvalue');
     $this->assertEquals('testvalue', r::get('testvar'));
 }