Two Shell_Exec Command with PHP button but still in the One powershell?

好久不见. 提交于 2019-12-05 12:25:30

I think the sessions of Powershell can be of help. This kind of problems are usually solved with that. The detailed documentation of starting and maintaining of sessions are available here

If you use a session, the commands can have continuity.

Use this: (2>&1 in shell_exec)

$result2 = shell_exec('powershell $port.ReadExisting() 2>&1');
echo $result2;

>& is the syntax to redirect a stream to another file descriptor - 0 is stdin, 1 is stdout, and 2 is stderr.

2 refers to the second file descriptor of the process, i.e. stderr.

> means redirection.

&1 means the target of the redirection should be the same location as the first file descriptor, i.e. stdout.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!