1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- class CronAction extends Action {
-
-
- public function searchFile2Ftp( ){
- while(true){
- $dir = C('FTP_LOCAL_DIR');
- $targetDir = C('FTP_SERVER_DIR');
- $config = C('FTP_CONFIG');
-
- $res = scanTargetFile($dir, 'md5');
- $files = explode(';', $res);
- array_pop($files);
- foreach($files as $v){
- $path_parts = pathinfo($v);
- $locDat = $path_parts['dirname']. '/' . $path_parts['filename'].'.dat';
- $tagetDat = $targetDir.'/'. $path_parts['filename'].'.dat';
- echo $tagetDat.PHP_EOL;
- $datRes = Zmcoding\FtpFile::getInstance($config)->up_file($locDat, $tagetDat);
- if($datRes){
- $md5Res = Zmcoding\FtpFile::getInstance($config)->up_file($v, $targetDir.'/'. $path_parts['basename']);//md5文件
- if($md5Res){
- debug_log('upload_info',json_encode($targetDir.'/'. $path_parts['basename'],JSON_UNESCAPED_UNICODE));
- }
- debug_log('upload_info',json_encode($tagetDat,JSON_UNESCAPED_UNICODE));
- }
- }
- sleep(3);
- }
- }
-
- }
|