/** * @param array $options * @return string * @throws \yii\base\Exception */ public static function Export(array $options = []) { static::$data = isset($options['data']) ? $options['data'] : []; static::$fileName = isset($options['fileName']) ? $options['fileName'] : 'file.csv'; if (!isset($options['dirName'])) { throw new Exception('You must set dirName'); } static::$dirName = $options['dirName']; if (static::$dirName[strlen(static::$dirName - 1)] !== '/') { static::$dirName .= '/'; } return self::array2csv(static::$data, static::$dirName, static::$fileName); }
protected function __construct() { static::$dirName = static::setDirName(__DIR__); // Load plugin. $this->load(); }