This extension allows to interact with processes through PTY. You may consider using the expect:// wrapper with the filesystem functions which provide a simpler and more intuitive interface.
This module uses the functions of the expect library. You need libexpect version >= 5.43.0.
To rozszerzenie PECL nie jest dołączane do PHP. Dodatkowe informacje, takie jak nowe wersje, pliki do pobrania, pliki źródłowe, informacje o opiekunach czy rejestr zmian, można znaleźć tutaj: http://pecl.php.net/package/expect.
W PHP 4 to rozszerzenie PECL można znaleźć w podkatalogu ext/ źródeł PHP lub pod znajdującym się wyżej odnośnikiem PECL. In order to use these functions you must compile PHP with expect support by using the --with-expect[=DIR] configure option.
Windows users will enable php_expect.dll inside of php.ini in order to use these functions. W PHP 4 ten DLL znajduje się w podkatalogu extensions/ binarnej dystrybucji PHP dla Windows. DLL z tym rozszerzeniem PECL można pobrać ze strony PHP Downloads lub http://snaps.php.net/.
Na działanie tych funcji wpływają ustawienia zawarte w pliku php.ini.
In order to configure expect extension, there are configuration options in the configuration file php.ini.
Tabela 1. Expect Opcje konfigurowalne
Nazwa | Domyślne | Zmienialne | Changelog |
---|---|---|---|
expect.timeout | "10" | PHP_INI_ALL | |
expect.loguser | "1" | PHP_INI_ALL | |
expect.logfile | "" | PHP_INI_ALL |
Oto krótkie wyjaśnienie dyrektyw konfiguracji.
The timeout period for waiting for the data, when using the expect_expectl() function.
A value of "-1" disables a timeout from occurring.
Notatka: A value of "0" causes the expect_expectl() function to return immediately.
Whether expect should send any output from the spawned process to stdout. Since interactive programs typically echo their input, this usually suffices to show both sides of the conversation.
Name of the file, where the output from the spawned process will be written. If this file doesn't exist, it will be created.
Notatka: If this configuration is not empty, the output is written regardless of the value of expect.loguser.
To rozszerzenie nie posiada żadnych rodzajów zasobów.
Poniższe stałe są zdefiniowane w tym rozszerzeniu i stają się dostępne, gdy rozszerzenie jest dokompilowane do PHP, lub załadowane dynamicznie przy starcie.
Indicates that the pattern is a glob-style string pattern.
Indicates that the pattern is an exact string.
Indicates that the pattern is a regexp-style string pattern.
Value, returned by expect_expectl(), when EOF is reached.
Value, returned by expect_expectl() upon timeout of seconds, specified in value of expect.timeout
Value, returned by expect_expectl() if no pattern have been matched.
This example connects to the remote host via SSH, and prints the remote uptime.
Poprzedni | Spis treści | Następny |
read_exif_data | Początek rozdziału | expect_expectl |