简体   繁体   English

我们可以使用外部PHP文件执行node.js文件吗?

[英]Can we execute node.js file using external PHP file?

I have a Node.js file which returns asterisk peer status on html file when I run command node -file name. 我有一个Node.js文件,当我运行命令节点-文件名时,该文件会在html文件上返回星号对等状态。 Is it possible to create a PHP script to run that file on click of button? 单击按钮是否可以创建一个PHP脚本来运行该文件? I tried PHP exec function but it didn't work ! 我尝试了PHP exec函数,但是没有用! I want that on click of button the script should start to execute and on another button it must stop the execution. 我希望单击按钮后脚本应该开始执行,而在另一个按钮上它必须停止执行。

Node.js only supports JavaScript. Node.js仅支持JavaScript。 Here is a tutorial on how to have PHP running with Node.js on the side. 这是关于如何使PHP与Node.js一起运行的教程。

http://blog.mixu.net/2011/01/04/nginx-php-fpm-and-node-js-install-on-centos-5-5/ http://blog.mixu.net/2011/01/04/nginx-php-fpm-and-node-js-install-on-centos-5-5/

Hope it helps :) 希望能帮助到你 :)

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

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