Ok,因此 pe子2本应是微粒的包装。 libssh2有libssh2_channel_get_exit_status。 是否有办法获取这一信息?
I NEED:
-STDOUT
-STDERR
-EXIT STATUS
我得到的是除出境外的一切。 许多人在sh子被 up倒时就扔下了别处,但我看不出有任何办法让步或渠道脱离: 没有人能够获得这三项?
Ok,因此 pe子2本应是微粒的包装。 libssh2有libssh2_channel_get_exit_status。 是否有办法获取这一信息?
I NEED:
-STDOUT
-STDERR
-EXIT STATUS
我得到的是除出境外的一切。 许多人在sh子被 up倒时就扔下了别处,但我看不出有任何办法让步或渠道脱离: 没有人能够获得这三项?
So, first thing is first:
NO, they didn t implement libssh2_channel_get_exit_status. Why? Beyond me.
Here is what id did:
$command .= ;echo -e "
$?"
我对一条新路线和回合美元? 我的每一位指挥官都即将结束。 干?吗? 是的。 但这似乎已经相当成功。 然后,我把这笔钱拖到回来,把所有新路线停下来。 或许几天后,该频道的撤离状态将得到支持,几年后,该频道将被拆除。 现在,这已经够了。 当你管理30+遥控指挥部,以集中复杂的偏远地区资源时,这远远胜于为每一指挥部设立并耗减短会。
我试图在拉齐德的答复中作更多的改进。 为了我的目的,我把sh子一带包裹在一个营地,并履行这两个职能。 这使我能够处理冲破旧式的错误。
function exec( $command )
{
$result = $this->rawExec( $command. ;echo -en "
$?" );
if( ! preg_match( "/^(.*)
(0|-?[1-9][0-9]*)$/s", $result[0], $matches ) ) {
throw new RuntimeException( "output didn t contain return status" );
}
if( $matches[2] !== "0" ) {
throw new RuntimeException( $result[1], (int)$matches[2] );
}
return $matches[1];
}
function rawExec( $command )
{
$stream = ssh2_exec( $this->_ssh2, $command );
$error_stream = ssh2_fetch_stream( $stream, SSH2_STREAM_STDERR );
stream_set_blocking( $stream, TRUE );
stream_set_blocking( $error_stream, TRUE );
$output = stream_get_contents( $stream );
$error_output = stream_get_contents( $error_stream );
fclose( $stream );
fclose( $error_stream );
return array( $output, $error_output );
}
由于SSH2 PHP延伸值的0.13版本,你可以使用<代码> 流_get_meta_data()来检索出的主机。
以你的榜样:
// $connection is a SSH2 connection created with ssh2_connect()
// $command is the command you want to execute
$stream = ssh2_exec($connection, $command);
$metadata = stream_get_meta_data($stream);
$exitCode = $metadata[ exit_status ];
I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
I found this script online that creates a thumbnail out of a image but the thumbnail image is created with poor quality how can I improve the quality of the image. And is there a better way to create ...
如何确认来自正确来源的数字。
Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...
I wonder there is a way to post a message to a facebook business page with cURL? thanks
I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...
How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...