鍍金池/ 問答/PHP  iOS  Linux  網(wǎng)絡(luò)安全/ shell_exec 印出結(jié)果?

shell_exec 印出結(jié)果?

假設(shè)我在 php 腳本中

abc.php

shell_exec("git status");

做這樣的動作
我在終端機(jī)打 abc.php

但這樣不會印出任何東西
如果是正常打這段git status指令會出現(xiàn):

On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   a.php
    modified:   x.php

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    .DS_Store

這樣的信息!
如何就算是用php腳本打這指令的時候
一樣能夠印出這個原始信息而不是空的不顯示?

回答
編輯回答
柒喵

exec 就可以

2018年6月26日 12:03