系统命令执⾏函数:
- string system(string KaTeX parse error: Expected 'EOF', got '&' at position 15: command[, int &̲return_var])
函数执⾏ command 参数所指定的命令,并且输出执⾏结果。 - string exec(string KaTeX parse error: Expected 'EOF', got '&' at position 17: …ommand[, array &̲output[, int &$return_var]])
exec() 执⾏ command 参数所指定的命令。 - string shell_exec(string $cmd)
通过 shell 环境执⾏命令,并且将完整的输出以字符串的⽅式返回。 - void passthru(string KaTeX parse error: Expected 'EOF', got '&' at position 15: command[, int &̲return_var])
执⾏外部程序并且显示原始输出。 - ``反引号
例如ls
,反引号的内容会被当做系统命令执⾏,其中内部就是执⾏了shell_exec()函数进⾏处理。 - void pcntl_exec(string $path[, array $args[, array e n v s ] ] ) p c n t l 是 p h p 的多进程处理扩展,在处理⼤量任务的情况下会使⽤到, p c n t l 需要额外安装。 a r g s 表示传递给 envs]]) pcntl是php的多进程处理扩展,在处理⼤量任务的情况下会使⽤到,pcntl需要额外安装。 args表示 传递给 envs]])pcntl是php的多进程处理扩展,在处理⼤量任务的情况下会使⽤到,pcntl需要额外安装。args表示传递给path程序的参数。 例如pcntl_exec(“/bin/bash" , array(“whoami”));
- resource popen(string $command, string $mode)
打开⼀个指向进程的管道,该进程由派⽣给定的 command 命令执⾏⽽产⽣。 例如popen(‘whoami >> 123.txt’, ‘r’); - resource proc_open(string $cmd, array KaTeX parse error: Expected 'EOF', got '&' at position 23: …torspec, array &̲pipes[, string $cwd[, array $env[, array $other_options]]])
执⾏⼀个命令,并且打开⽤来输⼊/输出的⽂件指针。类似 popen() 函数,但是 proc_open() 提供了更加强⼤的控制程序执⾏的能⼒。
代码执⾏:
eval;assert