mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
use constant as more intuitive example
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@197336 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9243160988
commit
fb0028c31d
1 changed files with 8 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- Purpose: system -->
|
||||
<!-- Membership: pecl -->
|
||||
|
||||
|
@ -49,30 +49,28 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
ini_set ("expect.loguser", "Off");
|
||||
|
||||
$fp = expect_popen ("ssh root@remotehost uptime");
|
||||
$stream = popen ("expect://ssh root@remotehost uptime", "r");
|
||||
|
||||
$cases = array (
|
||||
array (0 => "password:", 1 => "PASSWORD")
|
||||
array (0 => "password:", 1 => PASSWORD)
|
||||
);
|
||||
|
||||
switch (expect_expectl ($fp, $cases))
|
||||
switch (expect_expectl ($stream, $cases))
|
||||
{
|
||||
case "PASSWORD":
|
||||
fwrite ($fp, "password\n");
|
||||
case PASSWORD:
|
||||
fwrite ($stream, "password\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
die ("Error was occurred while connecting to the remote host!\n");
|
||||
}
|
||||
|
||||
while ($line = fgets ($fp)) {
|
||||
while ($line = fgets ($stream)) {
|
||||
print $line;
|
||||
}
|
||||
fclose ($fp);
|
||||
|
||||
fclose ($stream);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue