【问题标题】:Return the bash file code at the end of execution in php [duplicate]在php中返回执行结束时的bash文件代码[重复]
【发布时间】:2023-03-30 04:57:01
【问题描述】:

我在 php 文件中使用了 bash 文件。 (需要/包含)之后,当我想运行 bash 文件,但不想要的代码将被返回。结果终于来了。但是不必要的代码来了。

<?php
require_once("shapemorph");
ob_start();
$imageFile2 = 'one-car.jpg';
$imageFile1 = 'two-car.jpg';
shell_exec('./shapemorph -d 10 -p 100 -r "73,56 57,68" '.$imageFile2.' '.$imageFile2.' testfy.gif');
ob_end_flush();
exit;
?>

我也为此使用了 ob_start()。但是代码还是来了。

我不希望代码被退回。

【问题讨论】:

标签: php bash


【解决方案1】:

如果您使用 Linux,您可以将它们返回到 /dev/null

【讨论】:

  • 感谢您的回复。但是这段代码应该在服务器中工作。我不知道服务器配置。
  • 您还可以重定向文件中的输出并将其作为脚本的最后一个操作删除,例如:myscript &gt;&gt; trash.txt
  • 你是在 bash 文件中说的吗?
猜你喜欢
  • 2020-07-27
  • 1970-01-01
  • 1970-01-01
  • 2023-03-16
  • 2023-04-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-04-12
相关资源
最近更新 更多