系统程序执行
- 简介
- 安装/配置
- 预定义常量
- 程序执行函数
- escapeshellarg — 把字符串转码为可以在 shell 命令里使用的参数
- escapeshellcmd — shell 元字符转义
- exec — 执行一个外部程序
- passthru — 执行外部程序并且显示原始输出
- proc_close — 关闭由 proc_open 打开的进程并且返回进程退出码
- proc_get_status — 获取由 proc_open 函数打开的进程的信息
- proc_nice — 修改当前进程的优先级
- proc_open — 执行一个命令,并且打开用来输入/输出的文件指针。
- proc_terminate — 杀除由 proc_open 打开的进程
- shell_exec — 通过 shell 环境执行命令,并且将完整的输出以字符串的方式返回。
- system — 执行外部程序,并且显示输出

User Contributed Notes 2 notes
Anonymous ¶
2 years ago
Backticks is probably going to be deprecated. It's safer to not use it.
See details why:
https://wiki.php.net/rfc/deprecate-backtick-operator-v2
bishop at php dot net ¶
2 years ago
Similar to these functions, there is also the backtick ("back-tick") execution operator:
https://www.php.net/manual/en/language.operators.execution.php
<?php
$output = `ls -al`;
echo "<pre>$output</pre>";
?>
This operator runs the command given inside the backticks, and supports string interpolation just like double quotes:
<?php
$dir = addcslashes(sys_get_tmp_dir(), '"');
echo `ls "{$dir}"`;
?>