解析php中如何直接执行SHELL_php技巧

WBOY
Release: 2016-05-17 08:58:13
Original
851 people have browsed it

$message=shell_exec("sudo /usr/local/webserver/nginx/sbin/nginx -t 2>&1");
echo "运行结果:".$message."
";
 
上面的语句可以直接在PHP中执行SHELL语句

如果有返回值 那么其中的 2>&1 是必须的  他会重定向输出strerr 转到strout 输出!

否则返回结果会为空!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template