微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Laravel Livewire 中的 Exec 命令

如何解决Laravel Livewire 中的 Exec 命令

嗨,我在工匠命令中有以下代码

exec('rclone copy gdrive: --drive-root-folder-id '.$folderID.' storage/app/tmp/');
    //sleep(10);
    $platforms=array('Android','iOS','Linux','Windowsstore');
    foreach ($platforms as $platform ) {
        $existPlatform = Storage::exists('tmp/'.$platform);
        if($existPlatform){
            $isExists = Storage::exists('tmp/'.$platform.'/'.$uuid.'.zip');

            if ($isExists){
                
                $zip_file = 'storage/app/tmp/'.$platform.'/'.$uuid.'.zip';
                $zip = new ZipArchive ();
    
                if ($zip->open ($zip_file) === true) {
                    $zip->extractTo (storage_path ('app/tmp/'.$platform.'/'.$uuid.'/'));
                    }
                    $zip->close();
            
            }
            $files = File::allFiles('storage/app/tmp/'.$platform.'/'.$uuid.'');
            foreach($files as $file){
                if($bundLeversion!=1){
                    Storage::disk('s3-pruebas')->put(''.$platform.'/'.$bundLeversion.'/'.$uuid.'/'.$file->getFilename(),file_get_contents($file));
    
                }else{
                    Storage::disk('s3-pruebas')->put(''.$platform.'/'.$uuid.'/'.$file->getFilename(),file_get_contents($file));
    
                }
                
                
            }
        }
    }

代码所做的基本上是将本地文件夹与 rclone 同步到谷歌驱动器上。 如果我将该代码作为 laravel 命令运行,它可以完美运行。等待文件夹同步并继续。 另一方面,如果我创建一个 Laravel Livewire 组件,它不会通过复制相同的代码甚至调用 Artisan 函数来执行命令来工作。 使用 livewire 它只会为我创建 tmp 文件夹。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。