PHP Velho Oeste 2024

ncurses_clear

(PHP 4 >= 4.0.7, PHP 5 < 5.3.0, PECL ncurses >= 1.0.0)

ncurses_clearClear screen

설명

bool ncurses_clear ( void )
Warning

이 함수는 실험적입니다. 이 함수의 작동, 함수의 이름, 그리고 관련된 모든 문서는 이후의 PHP 릴리즈에서 예고 없이 변경할 수 있습니다. 이 함수의 사용에 관한 것은 사용자 책임입니다.

Clears the screen completely without setting blanks.

Note: ncurses_clear() clears the screen without setting blanks, which have the current background rendition. To clear screen with blanks, use ncurses_erase().

반환값

성공 시 TRUE를, 실패 시 FALSE를 반환합니다.

참고

add a note add a note

User Contributed Notes 1 note

up
-1
areaz at dotgeek org
20 years ago
When your script exits, after ncurses_clear() was called, it could leave your terminal in an inconsistent state.

Therefore, you should call ncurses_savetty() in a constructor and nurses_resetty() in a destructor, to ensure, that your terminal is working fine after your script exits.

Here is an example code snippet, on how to use this function, without falling into trouble ;-)

<? // PHP5 Example

class foo
{
   
/* Foo constructor */
   
function __construct()
    {
       
/* Initialize ncurses first */
       
ncurses_init();

       
/* Save your tty !!! */
       
ncurses_savetty();
    }

    function
bar ()
    {
       
/* Clear the screen and wait a few seconds */
       
ncurses_clear();

       
sleep(5);
    }

   
/* Foo destructor */
   
function __destruct()
    {
       
/* Restore your terminal settings */
       
ncurses_resetty();

       
/* End ncurses and clean up */
       
ncurses_end();
    }

}

$test_ncurses = new foo;
$test_ncurses->bar();
?>
To Top