* @version : HuoMp 1.0 */ namespace console\index\controller; use League\Flysystem\FileExistsException; use think\console\Input; use think\console\Output; use think\console\Command; class FileSystem extends Command { protected function configure() { $this->setName('filesystem')->setDescription('文件系统'); } /** * @param Input $input * @param Output $output * * @return int|null|void */ protected function execute(Input $input, Output $output) { try { $_filesystem = \FileSystem\FileSystem::create(); //目录不存在会自动创建 $_path = '/upload/qrcode/myimage.jpg'; $_stream = fopen(ROOT_PATH.'image.jpg', 'r+'); $_rs = $_filesystem->writeStream($_path, $_stream); var_dump($_rs); } catch (\Exception $_exception) { $_msg = 'file:'.$_exception->getFile().PHP_EOL. 'line:'.$_exception->getLine().PHP_EOL. 'msg:'.$_exception->getMessage(); echo $_msg; } } }