How to run multiple commands in system, exec or shell_exec?

前端 未结 4 1025
小鲜肉
小鲜肉 2021-01-23 00:05

I\'m trying to run shell command like this from php:

ls -a | grep mydir

But php only uses the first command. Is there any way to force php to p

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-23 00:46

    http://www.php.net/manual/en/function.proc-open.php

    First open ls -a read the output, store it in a var, then open grep mydir write the output that you have stored from ls -a then read again the new output.

    L.E.:

    
    

提交回复
热议问题