PHP 是不是被 Ruby on Rails 带上了邪路?
很早以前就想说说这个问题,在知乎里忍了很久,看了很多大神们的文字,终于忍不住把它提出来。。。
背景大家都知道,不多说了,开始是Ruby on Rails挑战PHP,现在几乎各种大点的PHP框架都在一个劲模仿Ruby on Rails。。。最厉害的就是CakePHP了。
然而很多制作大型框架的大神们貌似都忘记了PHP简单易用的本质,PHP不是Java,把一些东西封装得太厉害,感觉是弄巧成拙!
(字数限制,未完待续!)
回复内容:
php 开发团队缺少一位象DHH那样有想法的领袖。从5开始逐渐偏向java,看来php核心团队对“PHP不适合企业级开发”耿耿于怀。简单易用、适合新手的特性也逐渐丢弃。流行的php框架也都没有自己的设计思想,要么学spring,要么django,更多的是学rails,说到底,php并没有出现优秀的框架。说php被rails带上邪路我不太赞同,rails之所以优秀,得益于dhh提出的一些设计思想,比如dry,比如约定优先于配置。还有大量的最佳实践。php框架应该学习的是他的思想,而不是表面的东西。应该说是开发者被那些五花八门框架带上了邪路, Rails是刺激了PHP,
也有一半部分原CakePHP开发人员感觉是CakePHP不是很符合PHP,所以重开了一个Lithium PHP框架,
比起Zend,Symfony这些(个人觉得zend有太重的Java味道, 至于Symfony的函数名是不是obj-c味,CakePHP是不是rails味,Yii是不是.net味倒是不清楚了)“大型” 框架,Li3很不错 框架跟语言两码事,嫌邪就不用框架呗 (字数限制,上接问题)
拿官方的Zend Framework来说,我感觉它更像一个啥代码生成器,好多故弄玄虚的东西。用Zend Framework的时候,我感觉不是在编写一个网站而是感觉在用Java或是C#编写一个软件。完全没有PHP那种感觉。比起Zend Framework,Symfony做得有过之而无不及。就像Android在Linux上面自己做一个层一样,这些框架貌似想在PHP基础上自己再搞个层出来。PHP本来是一种非常高级的语言,这些框架却有把它变成底层语言的意思。
所以我更喜欢使用一些更轻量级的东西,比如ThinkPHP、CodeIgniter之类的东西。。。
-------------------
我承认PHP不太适合大型项目,大型项目你用Java啊!何必勉强PHP呢?听说Twitter不是也考虑放弃Ruby on Rails而改用Java了么。。。
希望听听大家的语言。。。 它可能受惊了
之前大学的时候玩过php,一开始工作用java,然后创业用rails。自己本身各种语言都玩。玩过这么多语言,觉得还是算比较全面的分析一下:
欢迎拍砖。
- 严谨性。 很难写出没有bug的代码,PHP本身是一门hack语言,各种打补丁的方式来扩展自己。
- 生态圈 。 php社区的投资或者积累都在web这块。PHP非常适合变化很快的web产品的开发。> ( @Allen )本身的优势就在于生成页面。但是在于事务,数学计算,安全等领域,PHP的积累都不足以支撑其在企业领域的应用。 php 开发团队缺少一位象DHH那样有想法的领袖。rails各种web的最佳实践(pjax,scss,coffee)甩开php几条街
- 应用场景 php更多的是前端,在后端,桌面端,移动端基本上没有任何的市场。
- 与其他平台系统的 互操作性(web service) 。企业老的系统通过webservice 进行交互,java,.net 都有成熟的解决方案。
- 版本演进。 php6一而再再而三被延迟发布。
- 语言被创造时候的基因。 >(php -- 超文本预处理器的字母缩写)(感谢@张画虫),显然主要是为了网页而生,当然这个历史很久了,不过从历史可以看出某些语言设计的初衷,而这些都会成为语言的基因,会随着语言的发展一直继承下来
- 维护成本
因为蕴含了太多的hack,太多的全局函数,魔术变量,各种不统一,维护成本非常高
php语言本身的特性不足一支撑一个框架所要表达的思想,导致的结果就是各种框架满天飞,质量参差不齐。
> ( 借用 @王小一 的话 )拿官方的Zend Framework来说,我感觉它更像一个啥代码生成器,好多故弄玄虚的东西。用Zend Framework的时候,我感觉不是在编写一个网站而是感觉在用Java或是C#编写一个软件。完全没有PHP那种感觉。比起Zend Framework,Symfony做得有过之而无不及。就像Android在Linux上面自己做一个层一样,这些框架貌似想在PHP基础上自己再搞个层出来。PHP本来是一种非常高级的语言,这些框架却有把它变成底层语言的意思。
至于php的优势就是成熟web产品,各种cms,还是很有价值的,比如wordpress。
用框架写运用确实太方便不喜欢框架可以不用啊 PHP简单易用,恐怕是很早以前的说法了。对一个PHP新手来说,如果不借助一个框架,写一个可靠的应用是很困难的。

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











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.

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 originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

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.

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

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.

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.
