定制 rannk/php-interactive-ssh 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rannk/php-interactive-ssh

Composer 安装命令:

composer require rannk/php-interactive-ssh

包简介

Provide an interactive ssh connection.

README 文档

README

provide an interactive ssh connection.

requirements

You need PHP version 5.3+ with the SSH2 extension.

Installation

The best way to add the library to your project is using composer.

$ composer require rannk/php-interactive-ssh:dev-master

Usage

This wraaper tool is very eash to use. But now we just provide using username and password to access the ssh connection.

How to use it

step 1: instance a connection object

<?php
$conn = new ssh\Connection(hostname, [port]);
$conn->authByPassword(username, password);

setp 2: create a session

<?php
$session = $conn->createSession();

setp 3: send your command

<?php
$session->expect('$');
$session->send('ls');
$session->expect('$');

method explain

session::expect(expect_word, expire_time, display_message) return String

expect_word(String):  which word you expected waiting for when you want to run next command

expire_time(int): The default is 0. set the waiting for time. The zero mean always wait.

display_message(boolean): To set true is mean display the output message that from command. 

session::send(command) return void

command(String): The shell command

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固