选择语言 :

 Module_Storage_Driver_File::set

存数据

boolean Module_Storage_Driver_File::set( string/array $key [, $data $value = null ] )

参数列表

参数 类型 描述 默认值
$key string/array 支持多存
$value $data Value 多存时此项可空 null
返回值
  • boolean
File: ./modules/storage/driver/file.class.php
public function set($key, $value = null)
{
    if (is_array($key))
    {
        # 支持多存
        $i=0;
        foreach ($key as $k=>$v)
        {
            if ($this->set((string)$k, $v))
            {
                $i++;
            }
        }

        return $i==count($key)?true:false;
    }

    $filename = $this->get_filename_by_key($key);

    $this->_format_data($value);

    return File::create_file($filename, $value, null, null, $this->storage);
}