Table of Contents
回复内容:
Home Backend Development PHP Tutorial 一个网站用两种或以上的后端编程语言会出现什么情况?为什么?

一个网站用两种或以上的后端编程语言会出现什么情况?为什么?

Jun 06, 2016 pm 04:43 PM
js node php python

例如,用了PHP,又用Python,再用node.js

回复内容:

做一个网站,Typescript/C#/SQL/C++四个都用上了都是很普遍的事情,网站又不只是你看到的那几行html就可以搞起来的 php和php的c扩展算不算两种语言= = 正题:
看看你要做的“网站”的规模,“一个网站用两种后端编程语言”,在生产中很常见,首先UI层会用快速开发的服务端语言,比如php;然后一些性能敏感的后端服务,会用上C/C++等低级语言;也可能一些http服务会选择java/c#这类开发;而有的服务会选择开速开发语言比如python甚至时髦的node.js。别忽略了数据库呢,SQL也是一种语言。
上点规模的网站,不可能只有一个后端的。
“会出现什么情况——没什么情况……真的
“为什么?”——因为这是需求,也是因地制宜


顺便我们看看一个网站到底需要多少种语言吧……
页面:
必选:html/css/js
可选:某些前端模板,如jade, ejs等;某些预处理语言,如less/sass/stylus/coffee script等
服务端UI层:
必选:服务端语言,如php, java, python, ruby, javascript至少选一种吧
可选:某些模板引擎,如smarty, velocity等
数据层:
必选:某种SQL,至少选一种吧
其他各种服务(可能小网站没有):
C/C++/java/C#……太多了,你能想象的任何编程语言,都可能出现在任何模块当中
工具链:
各种脚本(含shell脚本)、makefile等……
文档:
WORD(如果也算语言)、markdown 回答前提:一个网站,我理解为普通用户脑子中对某个网站和域名的定义,而非技术层面上的一个solution/project。

大型互联网企业里,这是正常情况。
针对单一场景,一贯的态度是,只有最合适的,没有最好的。
针对复杂场景,各司其职就很正常了不是吗?

多种语言的坏处,好像就是成本上有点问题,主要是管理成本。
技术总监要HOLD的住,他的工资自然不会是高级码农的级别。(当然管理成本构成远远复杂的多,就是以点带面的说说。)
但是现在的互联网公司真的很care这些成本吗?
care的那些都是边缘化的生死线公司,如果起不来就挂了。没钱玩个P的互联网啊。。。

还有其他好处,我就不细说了。能力所限。
但是我不说坏处,不是辩解,而是因为这是一个选择,如果坏处你无法忍受,自然就不会选择了。 只用两种语言?那是最简单的网站吧。一般网站都用到三种四种甚至更多的语言。

题主是觉得只用两种语言的网站不够高端大气上档次吗?

呃,这个,其实不用为这种虚无缥缈的名誉操心,等你的网站发展壮大起来,肯定就不止两种语言了。在现阶段,只用两种语言应该可以为你省不少事。 这里面的会有哪些情况。。。这个太泛了吧,亲。你让别人怎么回答?

1、团队合作
2、项目把控
3、两种语言集成方案

可以说整个项目的方方面面都是受到影响的。我是个外行不懂就不细说了。 PHP 和 SQL 算两种语言不算?
什么?简单 SELECT 不算?存储过程算不算?
SQL 都不算?PHP / Python 的 C 扩展算不算?

所以,这有什么好说的呢?每种语言都有自己擅长处理的问题和自己不擅长处理的问题,只要整个系统模块划分清楚,接口定义明确(包括有明确的调用规范,如 JSON / Thrift 等),用多少语言都没关系啊。 和做一把椅子用到多种工具一个道理。 关键是面向需要解决问题,能解决问题的语言就是好语言。 只要衔接的好是不会出问题的,做过一个网站,原来是asp+sqlserver2000写的,php重写的时候有一部分是来不及写的,加了cookie保证了数据可以互传就上线了,数据库也是加了个mysql存储文章
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP: An Introduction to the Server-Side Scripting Language PHP: An Introduction to the Server-Side Scripting Language Apr 16, 2025 am 12:18 AM

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP vs. Python: Use Cases and Applications PHP vs. Python: Use Cases and Applications Apr 17, 2025 am 12:23 AM

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Why Use PHP? Advantages and Benefits Explained Why Use PHP? Advantages and Benefits Explained Apr 16, 2025 am 12:16 AM

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

Choosing Between PHP and Python: A Guide Choosing Between PHP and Python: A Guide Apr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

Is the vscode extension malicious? Is the vscode extension malicious? Apr 15, 2025 pm 07:57 PM

VS Code extensions pose malicious risks, such as hiding malicious code, exploiting vulnerabilities, and masturbating as legitimate extensions. Methods to identify malicious extensions include: checking publishers, reading comments, checking code, and installing with caution. Security measures also include: security awareness, good habits, regular updates and antivirus software.

PHP and the Web: Exploring its Long-Term Impact PHP and the Web: Exploring its Long-Term Impact Apr 16, 2025 am 12:17 AM

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

Can visual studio code be used in python Can visual studio code be used in python Apr 15, 2025 pm 08:18 PM

VS Code can be used to write Python and provides many features that make it an ideal tool for developing Python applications. It allows users to: install Python extensions to get functions such as code completion, syntax highlighting, and debugging. Use the debugger to track code step by step, find and fix errors. Integrate Git for version control. Use code formatting tools to maintain code consistency. Use the Linting tool to spot potential problems ahead of time.

See all articles