Table of Contents
  1. PHP是一种面向对象语言,但面向对象并不彻底
  2.PHP无法实现特定功能
  3.PHP 是不安全的
  4. 它不能适应大型应用
  5. PHP只能用于网站开发
  6.开发过程慢
  7.专业开发人员不使用PHP
  8. 性能问题
  9. 便宜没好货
  10. PHP言过其实
  结束语
Home Backend Development PHP Tutorial PHP 语言急需避免的 10 大误区

PHP 语言急需避免的 10 大误区

Jun 13, 2016 pm 12:11 PM
facebook language php

PHP 语言需要避免的 10 大误区

  PHP是一种非常流行的开源服务器端脚本语言,你在万维网看到的大多数网站都是使用php开发的。但是,你大概很奇怪的注意到有少部分的人发誓要离php 远远的。但是令人更奇怪的是或者很震惊的说他们不用php是因为一些被证实的语言缺点。他们决定不用php,是基于误解。

  是的,你读到的那些是误解。

  让我们看看这些误解是:

  1. PHP是一种面向对象语言,但面向对象并不彻底

  这完全不对。所有认为php不是彻底面向对象的程序员,尤其是Java程序员,都需要上一个PHP的基础培训;他们会发现PHP中大量面向对象的特性。例 如:接口、方法、抽象类等等。我同意早期的PHP版本确实不支持太多面向对象的特性,但PHP5已经有强大的面向对象支持。而且,你一定想不到编码在 PHP中会变得如此简单,那是因为PHP和面向对象结合的原因。

  所以,消除这个误解吧。

  2.PHP无法实现特定功能

  我很清楚这种表述很含糊,但是我不能想出任何更好的说法。这是一个很含糊的误解,开发人员认为PHP不能帮助他们实现一些诸如内存访问的功能或者一些 PHP主要发行版没有提供支持的功能。但事实是PHP是一种可扩展的语言,所以你需要做的是用C或者C++编码,然后创建对应的扩展。

  其实,你根本不需要自己动手去创建扩展,因为这里已经有数以百计的可用扩展。你唯一需要做的就是去寻找它们。

  3.PHP 是不安全的

  开发者对PHP的另外一个误解就是PHP网站和 应用是不安全的。但是,为什么你会希望它在默认情况下是安全,为什么不编写安全的代码? 我知道这里一直存在很多不安全的PHP代码,因为最初的学习曲线是简单的而且很容易上手。所以,作为一个开发者,你需要使它尽可能的安全。

  .Net可以帮助你在默认情况下是安全的,相比之下PHP确实缺少很多。但是如果你是一个训练有素的程序员,那么你其实不要默认情况的安全帮助。Include通常是安全的,但是你需要要小心。如果它们的路径是动态生成的,对指令的透彻理解可以帮助你让代码更安全。

  4. 它不能适应大型应用

  大型复杂应用需要建立在自身可靠和高性能的语言之上,这是PHP在一定程度上所没有的。但是,如果你设计和开发的应用程序架构稳定,为什么你会对它的性能和可扩展性有疑问呢?

  事实上一些顶尖网站,如Facebook、维基百科和雅虎等等,都是基于PHP构建的,就像我们所想的那样,这些巨型网站都工作的很好。

  5. PHP只能用于网站开发

  这也是一个误解,尽管看起来它有点合乎逻辑,因为PHP是网站开发中最常见的语言。但也有一些被称为命令行界面的东西,这可以确保你的PHP应用程序可以在Web服务器之外运行。

  你可能不相信,但即使是那些很大程度上取决于CPU能力的应用程序,也可以用PHP开发的,使用PHP CLI来运行。

  更重要的是,如果你想使用PHP开发桌面应用程序,不用担心,使用Windows特定扩展你可以做到这一点。

  6.开发过程慢

  这是一直广为流传的误解。我不知道起源于何处?这个流言可能来自于曾经一个时期php代码很乱并且代码中四处充斥着Mysql语句(他们以此为反例,但是 实际上我们都不这样用)。问题是为什么这样开发过程就慢了?当大量的php框架出现时,可以大大的加速开发的过程。毋庸置疑,你可以在短时间内开发出很大 的程序,不论它有多么的复杂。所以,你用php开发一点都不慢,特别是当你使用php框架的时候。

  7.专业开发人员不使用PHP

  PHP是针对初学者的,它是为那些不是认认真真做开发的人设计的。这些说法都和PHP的使用有关。这只是一种误解,认同它没有任何意义。这里有如此多的网络应用,包括一些大型的,都是使用PHP构建的。可以想象这些说法是多么不正确。

 

  8. 性能问题

  这是一个棘手问题。这不是一个误解。和硬币有两个面一样,这个问题也是两方面的。事实上到处充斥着垃圾代码,隐式转换、不适用的模块、缺少操作符重载等等都能影响一个php应用的性能。但是这个依赖于你是不是有足够的能力去用好这个语言,用它编写稳定地、快速地应用。

  性能是由你设计的架构和你写的代码来决定的!

  9. 便宜没好货

  这条貌似在逻辑上很站得住脚,但是用到php上那就是完全是误解了!事实上,php的最大优势就是他的免费和开源,这意味着大多数提供应用开发服务的开发 者必须都精通它。虽然免费开源会带来一定问题,但是这也为了使用他们服务的客户提供成本优势。与商业开发语言相比较,php的开发成本比价低,但是这并非 意味着它的质量值得怀疑。和正确的开发者一起工作,可以获得更高性能的php应用。

  10. PHP言过其实

  真是这样么?你随口瞎说的吧。我不认为这样,还有很多的开发者也都不这样认为。

  结束语

  这不是所有php谎言的终结者。随着php语言不断的发展,变得越来与强大,误解也会跟着增长的。但请不要被他们忽悠了。多读,多问,自己动动手,然后你就知道,是不是真的了。

  英文原文:PHP Language – Top 10 Misconceptions to Avoid

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 Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Hot Topics

Java Tutorial
1667
14
PHP Tutorial
1273
29
C# Tutorial
1255
24
PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP vs. Other Languages: A Comparison PHP vs. Other Languages: A Comparison Apr 13, 2025 am 12:19 AM

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

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.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP: Handling Databases and Server-Side Logic PHP: Handling Databases and Server-Side Logic Apr 15, 2025 am 12:15 AM

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

PHP's Purpose: Building Dynamic Websites PHP's Purpose: Building Dynamic Websites Apr 15, 2025 am 12:18 AM

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

See all articles