【发布时间】:2019-11-26 06:19:53
【问题描述】:
我有以下 newman 命令:
newman run "collection.json" -e "environment.json" --reporters html,cli --reporter-html-template ~/node_modules/newman-reporter-html/lib/template-default.hbs --reporter-html-export test_result.html --delay-request 1500
我将上面的命令保存在 test.sh 文件中。当我将文件作为 ./test.sh 运行时,它会生成 html 输出,但是当从 php 文件运行相同的文件时,它不会生成 html 文件。
下面是我的php文件
<?
$cmd = file_get_contents("test.sh");
while (@ ob_end_flush()); // end all output buffers if any
$proc = popen($cmd, 'r');
echo '<pre>';
while (!feof($proc))
{
echo fread($proc, 4096);
@ flush();
}
echo '</pre>';
?>
这个 php 文件执行 newman 命令并在浏览器窗口中打印终端的实时输出。执行后,它应该生成 html 文件,但它不会。谁能帮我指出我做错了什么或者还有其他 newman 命令吗?
【问题讨论】:
标签: php html postman postman-collection-runner newman