简体   繁体   English

我可以在Node JS Web服务器中运行php文件或html文件吗?

[英]Can i run a php file or a html file in a node js web server?

也许这是一个愚蠢的问题,但是我是使用节点js的新手,我认为它只能与js文件一起使用,我不知道,我在Windows上安装了节点js,然后启动了Web服务器,但我不知道如何运行文件,我一直使用apache,我看到node js安装文件夹中有一个名为scrips的文件夹

but i dont know how to run the files, I have always worked with apache. 但是我不知道如何运行文件,我一直都使用apache。

In NodeJS, it's either you write the web server (it's like writing Apache itself), or use a framework that does it for you (it's like adding in something like Apache). 在NodeJS中,要么编写Web服务器(就像编写Apache本身),要么使用为您完成此工作的框架(就像添加Apache之类的东西)。 Suggesting you check out Express . 建议您检查Express It's something almost close to CodeIgniter (writing points of entry). 它几乎接近CodeIgniter(编写入口点)。

Can i run a php file or a html file in a node js web server? 我可以在Node JS Web服务器中运行php文件或html文件吗?

NodeJS is for JS. NodeJS用于JS。 Your server files are all in JS. 您的服务器文件全部在JS中。 As for HTML, checkout Express (mentioned above), or if you just want to serve plain HTML (or static files), you may want to check out Connect Static 至于HTML,请签出Express(如上所述),或者如果您只想提供纯HTML(或静态文件),则可能要签出Connect Static。

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

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