我们看exec调用命令的输出,常常是空的。原因在于命令的输出不是输出到stdout的,而是stderr。

exec("rm 1.txt" , $out);

改为

exec("rm 1.txt 2>&1" , $out);


0(stdin,标准输入)、1(stdout,标准输出)、2(stderr,标准错误输出),默认与keyboard、monitor、monitor有关

相关文章:

  • 2021-10-15
  • 2022-02-13
  • 2022-12-23
猜你喜欢
  • 2022-01-24
  • 2021-11-17
  • 2021-11-23
  • 2021-08-03
  • 2021-07-05
  • 2021-06-02
  • 2021-09-14
相关资源
相似解决方案