Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP Windows CLI和a";“实时统计图形用户界面”;_Php_User Interface_Windows 7 - Fatal编程技术网

PHP Windows CLI和a";“实时统计图形用户界面”;

PHP Windows CLI和a";“实时统计图形用户界面”;,php,user-interface,windows-7,Php,User Interface,Windows 7,我正在尝试为我的一个作为PHPCLI应用程序运行的项目制作一种实时显示,我在清除控制台并实现这一点上遇到了一些困难 基本上,我的最终目标是这样的: --------------------------------------------------------------- | [ _ ] [ [] ] [ X ] | ------------------------------------------------

我正在尝试为我的一个作为PHPCLI应用程序运行的项目制作一种实时显示,我在清除控制台并实现这一点上遇到了一些困难

基本上,我的最终目标是这样的:

---------------------------------------------------------------
|                                          [ _ ] [ [] ] [ X ] |
---------------------------------------------------------------
| Lag: 120 ms              Foo: 1240 bar     Users: 240,000   |
| Some stat: 12434 things  Status: connected Cake: nominal    |
|                 -------------------------                   |
| Some form of console output here, buffered so I can clear   |
| the screen with no worries and it will display nicely to    |
| the end user. A couple of lines of stats, and this output   |
| buffer will suffice, no need for any interactivity. Keeping |
| the positions of the stats and output static increase       |
| readability since I can just check at a glance, and keep my |
| output constantly refreshing instead of every few seconds.  |
---------------------------------------------------------------  
这将更新无闪烁,不会导致实际的命令行缓冲区滚动或将缓冲区中的行数增加到垂直高度以外

我在一小段文本上测试了
\r
,它确实可以以无闪烁的方式覆盖它。但是,如果该文本位大于一行(我认为是80个字符,如果我错了请纠正我),则它不会覆盖整行,即使该行被窗口的大小而不是
\n
\n\r
打断。因此,我放弃了这种方法

接下来,我转向和,只是意识到不,它们实际上并不适用于Windows 7上的命令提示符,正如PHP所应用的那样


如何在Windows 7中实现预期效果,而不使用备用命令提示符或安装任何插件?

我认为您正在寻找错误的解决方案。您可以研究使用PHP调用Win32 API,但我建议您只需通过MSYS运行PHP守护程序并使用ANSI转义代码。这正是你想要的