一个网站采用哪种开发语言的背后可能总有些很另类的原因。 其实用什么语言只有技术人员比较关心,但也是个值得一说的话题。
回复内容:
这应该是历史原因,任何巨头都是从小长大的。FaceBook 的 PHP 属于粘结剂语言,并且转成 C++ 执行。
并且正如 Facebook 工程师所言 架构,类库 远比用什么语言重要。 1. PHP 是专门面向 HTTP Server Side 的语言
2. PHP 写的不错,语法解析器什么的很精简高效
3. PHP 开销低,不像Java 每次必须弄个虚拟机,非常适合HTTP.
4. 用的人多,开发人员好找 Flickr 的 Cal Henderson 这句话就能说明了: "Languages's don't Scale, Architecture Scale"
实际上选择一门语言并没有为什么,再mark写facebook的时候他最熟悉php,他能用php解决facebook所需要解决的一切问题,那么就选择它啊。
而且事实证明,php确实适合做webend开发。
当然更重要的是,在那个时代,geek们都是用php写网站的。
至于编译成c++什么的,那是fb发展都后面性能要求越来越高才不得已发明出来的解决方案,跟选择什么语言没有关系。
- 工程师好找
- 学习成本低
- 更灵活
在把PHP作为开发核心语言的问题上,Facebook吃尽了苦头,PHP的架构问题已经不是Framework之类能够解决的了。但是木已成舟,这么庞大的系统,庞大的雇员,完全迁移到另外一种语言上已经不太可能。所以在Facebook做HipHop预编译的努力之后,又开始做HipHop JIT解析器的努力。这篇文章对于技术详情介绍得很仔细 HHVM 是如何提升 PHP 性能的? 历史原因! 历史原因,他们后悔了。现在进去的都在用python呢 因为开源,LAMP是现在最流行的黄金搭配,因为php用起来简单,不过越容易用的脚步就越耗内存,比如php,js这些远没有原生的C/C++运行的快。facebook的php架构分了很多层,为了运行效率,他们也在php转化为C这方面花了很多功夫。

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver CS6
Visual web development tools
