【问题标题】:Serve PHP through nodejs socket.io通过 nodejs socket.io 服务 PHP
【发布时间】:2016-01-01 06:11:15
【问题描述】:

我在我的应用程序中同时运行 nodejs 和 php,但只能使用 一个 端口。所以我想做的是让 nodejs 成为端口上的用户,然后通过路由将 index.php 提供给用户,例如:

app.get("index.php") 

有人知道我该怎么做吗?非常感谢...

【问题讨论】:

    标签: php node.js heroku socket.io


    【解决方案1】:

    您可以尝试将要用作应用程序主入口点的 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"
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2016-08-20
      • 2014-09-16
      • 2011-10-19
      • 1970-01-01
      • 1970-01-01
      • 2011-12-09
      • 2020-04-09
      • 2011-09-23
      • 1970-01-01
      相关资源
      最近更新 更多