This question already has an answer here:
这个问题已经有了答案:
- What are the advantages of using Node.js vs PHP [duplicate] 1 answer
- 使用节点的优点是什么?一个答案
I am totally lost of what Node.js is all about so here's my question:
我完全不知道哪个结点。js就是这样我的问题是
Is node.js a new language which can replace PHP or it is a language which can/only compliment/supplement PHP and other web languages to perform complex task?
是节点。js是一种可以替代PHP的新语言,还是一种只能恭维/补充PHP和其他web语言来执行复杂任务的语言?
3 个解决方案
#1
25
Node.js is server side Javascript environment based on chrome V8 javascript engine. It enables you to write your server code in javascript, instead of choosing one of the "traditional" web languages such as PHP, c#, python, ruby, perl etc. Using node.js and database such as mongodb you could write your web application completely in javascript.
节点。js是基于chrome V8 Javascript引擎的服务器端Javascript环境。它允许您使用javascript编写服务器代码,而不是使用node选择“传统”web语言之一,如PHP、c#、python、ruby、perl等。可以用javascript完全编写web应用程序。
Here's example of the full stack for web development:
下面是web开发的完整堆栈示例:
- Backbone for client side, code that runs in the browser (chrome,firefox)
- 客户端主干,在浏览器中运行的代码(chrome,firefox)
- Express server side framework running on Node.js
- 在Node.js上运行的Express服务器端框架
- Mongodb database for storing documents
- Mongodb数据库用于存储文档
Above mentioned technologies will enable you create your application writing only javascript code, from browser to server and finally to database, sort of one language to rule them :), no need for PHP unless you have legacy codebase .
上面提到的技术将使您创建的应用程序只编写javascript代码,从浏览器到服务器,最后到数据库,某种语言来管理它们:),除非您有遗留代码库,否则不需要PHP。
#2
4
First you have to understand the difference between server-side and client-side code.
首先,您必须了解服务器端代码和客户端代码之间的区别。
Server-side code runs on the server, and it can do stuff like reading a database, getting file contents from the server, send mails etc. Examples of server-side code are PHP, Node.js, ASP.
服务器端代码在服务器上运行,它可以做一些事情,比如读取数据库、从服务器获取文件内容、发送邮件等。js,ASP。
Client-side code runs in the users webbrowser. It is used to make webpages interactive. This is mainly written in JavaScript.
客户端代码在用户web浏览器中运行。它用于使网页具有交互性。这主要是用JavaScript编写的。
PHP and Node.js are both server-side programming languages (altough node is a framework, but lets not make this any more complicated). They can both do things like database processing, reading files. As far as I know, you can't use both PHP and Node.js at the same time, so they can't even work together (there is probably some way to achieve this)
PHP和节点。js都是服务器端编程语言(altough node是一个框架,但我们不要让它变得更复杂)。它们都可以做诸如数据库处理、读取文件之类的事情。据我所知,您不能同时使用PHP和Node。同时,它们甚至不能协同工作(可能有某种方法可以实现这一点)
So to wrap it up: Node.js and PHP are both server-side and they can do the same thing. Node.js can replace PHP and vice versa
总结一下:Node。js和PHP都是服务器端,它们可以做同样的事情。节点。js可以替代PHP,反之亦然
#3
0
I think you should look at least at this site before you ask, even so I think it will resolve your doubts. How to decide when to use Node.js?
我认为你应该先看看这个网站,然后再问,即使如此,我认为它将解决你的疑问。如何决定何时使用Node.js?
#1
25
Node.js is server side Javascript environment based on chrome V8 javascript engine. It enables you to write your server code in javascript, instead of choosing one of the "traditional" web languages such as PHP, c#, python, ruby, perl etc. Using node.js and database such as mongodb you could write your web application completely in javascript.
节点。js是基于chrome V8 Javascript引擎的服务器端Javascript环境。它允许您使用javascript编写服务器代码,而不是使用node选择“传统”web语言之一,如PHP、c#、python、ruby、perl等。可以用javascript完全编写web应用程序。
Here's example of the full stack for web development:
下面是web开发的完整堆栈示例:
- Backbone for client side, code that runs in the browser (chrome,firefox)
- 客户端主干,在浏览器中运行的代码(chrome,firefox)
- Express server side framework running on Node.js
- 在Node.js上运行的Express服务器端框架
- Mongodb database for storing documents
- Mongodb数据库用于存储文档
Above mentioned technologies will enable you create your application writing only javascript code, from browser to server and finally to database, sort of one language to rule them :), no need for PHP unless you have legacy codebase .
上面提到的技术将使您创建的应用程序只编写javascript代码,从浏览器到服务器,最后到数据库,某种语言来管理它们:),除非您有遗留代码库,否则不需要PHP。
#2
4
First you have to understand the difference between server-side and client-side code.
首先,您必须了解服务器端代码和客户端代码之间的区别。
Server-side code runs on the server, and it can do stuff like reading a database, getting file contents from the server, send mails etc. Examples of server-side code are PHP, Node.js, ASP.
服务器端代码在服务器上运行,它可以做一些事情,比如读取数据库、从服务器获取文件内容、发送邮件等。js,ASP。
Client-side code runs in the users webbrowser. It is used to make webpages interactive. This is mainly written in JavaScript.
客户端代码在用户web浏览器中运行。它用于使网页具有交互性。这主要是用JavaScript编写的。
PHP and Node.js are both server-side programming languages (altough node is a framework, but lets not make this any more complicated). They can both do things like database processing, reading files. As far as I know, you can't use both PHP and Node.js at the same time, so they can't even work together (there is probably some way to achieve this)
PHP和节点。js都是服务器端编程语言(altough node是一个框架,但我们不要让它变得更复杂)。它们都可以做诸如数据库处理、读取文件之类的事情。据我所知,您不能同时使用PHP和Node。同时,它们甚至不能协同工作(可能有某种方法可以实现这一点)
So to wrap it up: Node.js and PHP are both server-side and they can do the same thing. Node.js can replace PHP and vice versa
总结一下:Node。js和PHP都是服务器端,它们可以做同样的事情。节点。js可以替代PHP,反之亦然
#3
0
I think you should look at least at this site before you ask, even so I think it will resolve your doubts. How to decide when to use Node.js?
我认为你应该先看看这个网站,然后再问,即使如此,我认为它将解决你的疑问。如何决定何时使用Node.js?