简体   繁体   English

在PHP中运行Raspberry PI的SSH命令

[英]Running SSH Command from Raspberry PI in PHP

when executing this command in linux wheezy throug SSH, it works fine; 通过SSH在Linux中执行此命令时,它工作正常;

pi@raspberry /usr/bin $ ./send -u 2 -i 0546845 -f

But how can i put this in for example test.php page (from var/www/test.php) so i can run this in a webpage? 但是我怎么能把它放在例如test.php页面(来自var / www / test.php)中,这样我就可以在网页中运行它了?

Tried several things, but need some help getting into the right direction. 尝试了几件事,但需要一些帮助才能找到正确的方向。

Many thanks. 非常感谢。

使用system功能

string system ( string $command [, int &$return_var ] )

I don't know how to reply to an "answer".. hehe.. 我不知道怎么回复“答案”..呵呵..

I think you can simply do this: 我想你可以这样做:

system('/usr/bin $ ./send -u 2 -i 0546845 -f');

add that to your php script. 将它添加到您的PHP脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM