如何在php cli中清除屏幕(如cls命令)
当PHP脚本从命令行(windows)运行时,如何从脚本中清除控制台屏幕。
例如:
while(true){
// sleep for 10 seconds , then clear the console
sleep(10);
// below command execute to clear the console windows
**COMMAND**
}
当PHP脚本从命令行(windows)运行时,如何从脚本中清除控制台屏幕。
例如:
while(true){
// sleep for 10 seconds , then clear the console
sleep(10);
// below command execute to clear the console windows
**COMMAND**
}
如果您对上述解决方案没有任何运气,请考虑以下几点
echo chr(27).chr(91).'H'.chr(27).chr(91).'J'; //^[H^[J
希望它会有所帮助。
来源 : http://pank.org/blog/2011/02/php-clear-terminal-screen.html
对于视窗用户:
system('cls');
对于 Linux 用户:
system('clear');