我正在尝试使 viewgit 界面适用于我的项目。
但是,我在 PHP exec 中遇到了这个奇怪的问题:
这 2 个 unix 命令在我的 viewgit/ 目录中工作:
/viewgit-> GIT_DIR=/usr/local/apache2/htdocs/repo/.git git rev-list --header --max-count=1 c19e231ad87413798b6a1387a98ec814836fda1e 19e231ad87413798b6a1387a98ec814836fda1e c19e231ad87413798b6a1387a98ec814836fda1e 树 4351aa5fb93c3a093902577e5a58138280851152 父 5099ea6747f8b8a532d153f0536e7be956532a33 作者 John.smith514-490-6597 1255981013 -0400 提交者 John.Smith514-490-6597 1255981013 -0400
和
/viewgit-> GIT_DIR=/usr/local/apache2/htdocs/repo/.git git diff c19e231ad87413798b6a1387a98ec814836fda1e^..c19e231ad87413798b6a1387a98ec814836fda1e 差异 --git a/bootstrap.php b/bootstrap.php 索引 6cc6336..857890b 100755 --- a/bootstrap.php +++ b/bootstrap.php @@ -17,7 +17,7 @@ ); // ZEND 库 - //---------------------------------------- + //---------------------------------------- // 1.7 //require_once "Zend/Loader.php"; //Zend_Loader::registerAutoload();
但是,当使用 php exec 时,只有第一个返回输出:
$output_1 = 数组(); $output_2 = 数组(); $cmd_1 = "GIT_DIR=/usr/local/apache2/htdocs/repo/.git git rev-list --header --max-count=1 c19e231ad87413798b6a1387a98ec814836fda1e"; $cmd_2 = "GIT_DIR=/usr/local/apache2/htdocs/repo/.git git diff c19e231ad87413798b6a1387a98ec814836fda1e^..c19e231ad87413798b6a1387a98ec814836fda1e"; 执行($cmd_1,$output_1,$ret); 执行($cmd_2,$output_2,$ret);
$output_1 实际上包含来自命令行的数据......但是, $output_2 是空的!
关于造成这种情况的任何想法?
谢谢