2

根据 Symfony 文档,我尝试将以下命令行传递给 Symfony Process 组件:

use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;

$process = new Process(['cat crons/* | crontab -']);
$process->run();

还有以下内容:

$process = new Process(['cat crons/*', '|', 'crontab -']);

和:

['cat crons/*', '|', 'crontab', '-']

但它不起作用,它引发了一个例外:

 The command "'cat /var/www/config/crontab/* | crontab -'" failed.       
                                                                          
  Exit Code: 127(Command not found)                                       
                                                                          
  Working directory: /var/www                                             
                                                                          
  Output:                                                                 
  ================                                                        
                                                                          
                                                                          
  Error Output:                                                           
  ================                                                        
  sh: exec: line 1: cat /var/www/config/crontab/* | crontab -: not found

请问有人有解决办法吗?

4

0 回答 0