【发布时间】:2016-01-01 06:11:15
【问题描述】:
我在我的应用程序中同时运行 nodejs 和 php,但只能使用 一个 端口。所以我想做的是让 nodejs 成为端口上的用户,然后通过路由将 index.php 提供给用户,例如:
app.get("index.php")
有人知道我该怎么做吗?非常感谢...
【问题讨论】:
标签: php node.js heroku socket.io
我在我的应用程序中同时运行 nodejs 和 php,但只能使用 一个 端口。所以我想做的是让 nodejs 成为端口上的用户,然后通过路由将 index.php 提供给用户,例如:
app.get("index.php")
有人知道我该怎么做吗?非常感谢...
【问题讨论】:
标签: php node.js heroku socket.io
您可以尝试将要用作应用程序主入口点的 index.php 文件放入 package.json 文件中。只需将 main 属性替换为您自己的 URL。
package.json:
{
"name": "NodeTesting",
"description": "Used for node testing and developing scripts",
"version": "0.0.1",
"main": "http://localhost/launchjs/index.php",
"author": {
"name": "bytewarestudios",
"email": "admin@bytewarestudios.com"
},
"keywords": [],
"licenses": {
"type": "none"
},
"repository": {
"type": "git",
"url": "git://github.com//bytewarestudios"
},
"bugs": {
"url": "http://github.com//NodeTesting/issues"
}
}
【讨论】: