存数据
boolean Module_Storage_Driver_Swift::set( string/array $key [, $data $value = null ] )
参数列表
参数 类型 描述 默认值 $key
string/array
支持多存 $value
$data
Value 多存时此项可空 null
boolean
public function set($key, $value = null)
{
if (is_array($key))
{
$rs = true;
foreach ($key as $k=>$v)
{
if (!$this->set($k, $v))
{
$rs = false;
}
}
return $rs;
}
$this->_format_data($value);
$rs = $this->get_response($key, 'PUT', null, null, $value);
if ($rs['code']>=200 && $rs['code']<300)return true;
throw new Exception(__('Swift get error, code: :code.', array(':code'=>$rs['code'])));
}