简体   繁体   English

与终端的PHP和Javascript通信

[英]PHP and Javascript communication with Terminal

I was wondering if there is a way by using PHP and Javascript (+AJAX) so as to have a box inside of which the contents of the terminal screen of a linux system are going to be displayed. 我想知道是否有一种使用PHP和Javascript(+ AJAX)的方法,以便在其中有一个要显示linux系统终端屏幕内容的框。 I need this feature because I am trying to make an html terminal for a website I am building, where the user can run it's programs interactively through the internet. 我需要此功能,因为我正在尝试为我正在构建的网站创建html终端,用户可以在其中通过Internet交互地运行其程序。

This is possible. 这个有可能。 Just let jQuery (or any other JS library, or just JS) perform an AJAX-request to a PHP script that runs system commands, like (shell_)exec. 只需让jQuery(或任何其他JS库或仅JS)对运行系统命令(如(shell_)exec)的PHP脚本执行AJAX请求即可。 That way you can retreive the output and show it in a textbox! 这样,您可以检索输出并将其显示在文本框中!

http://api.jquery.com/jQuery.post/ http://api.jquery.com/jQuery.post/

http://nl2.php.net/shell_exec http://nl2.php.net/shell_exec

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

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