我使用的是Laravel框架和宅基地。(最新版本),我正在尝试使用ssh2_connect。我已经安装了分机
sudo apt install php-ssh2我已经测试过它的作用
php -m |grep ssh2我看到了
ssh2我假设这是正确的,但当我试图建立一个连接,我会得到以下错误。
Call to undefined function App\Http\Controllers\ssh2_connect()这是我正在执行的代码
$connection = ssh2_connect($request->sever_ip, 2222);
if (!$connection) die('Connection failed');有人能给我指明正确的方向吗?
发布于 2017-01-16 14:52:23
因为您位于Controllers的命名空间中,所以可能需要使用:
$connection = \ssh2_connect($request->sever_ip, 2222);
if (!$connection) die('Connection failed');https://stackoverflow.com/questions/41679025
复制相似问题