duanchuan6350 2015-10-04 13:46
浏览 56

通过nodejs socket.io提供PHP服务

I'm running both nodejs and php in my app but can only use one port. So what I'd like to do is to make nodejs the user on the port and then give index.php to the user by routing, something like:

app.get("index.php") 

Does anyone have any idea on how I could do this? Thank you very much...

  • 写回答

1条回答 默认 最新

  • drtoaamk20278 2015-10-04 13:59
    关注

    You could try placing the index.php file you want to use as the main entry point of your application by putting it in the package.json file. Just replace the main property with your own 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"
        }
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料