123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- 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('文件系统');
- }
-
- 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;
- }
- }
- }
|