PHP exec() return value for background process (linux)

前端 未结 3 1051
南方客
南方客 2020-12-22 04:02

Using PHP on Linux, I\'d like to determine whether a shell command run using exec() was successfully executed. I\'m using the return_var parameter to check for a successful

3条回答
  •  时光说笑
    2020-12-22 05:06

    Just my 2 cents, how about using the || or && bash operator?

    exec('ls && touch /tmp/res_ok || touch /tmp/res_bad');
    

    And then check for file existence.

提交回复
热议问题