简体   繁体   English

Php-cli少再生

[英]Php-cli less resoult

I start coding php-cli script for manipulation with hosts and VirtualHost files in linux. 我开始编写php-cli脚本,用于操作主机和linux中的VirtualHost文件。

https://github.com/ErgallM/deep all program https://github.com/ErgallM/deep所有程序

In https://github.com/ErgallM/deep/blob/master/library/Host.php#L34 printing hosts element. https://github.com/ErgallM/deep/blob/master/library/Host.php#L34打印主机元素。

How to less php output? 如何减少PHP输出?

You can do fgets() on STDIN file after you output like 30 lines. 输出30行后,可以在STDIN文件上执行fgets()。 This will cause user to wait. 这将导致用户等待。

A quick hack would be to prefix your code with.... 快速破解将为您的代码添加前缀....

 <?php

   $reentry='reenteredxx123';
   if ($argv[1]!=$reentry) {
      $script=aray_shift($argv);
      $clean=array_map('escapeshellarg',$argv);
      $cmd="php $script $reentry" . implode(' ',$clean) . ' | less';
      system($cmd);
      exit;
   } else {
      unset($argv[1]);
   }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM