致初学者:PHP比ASP优秀的七个理由_MySQL
ASP是微软公司实现动态网页的一种技术。ASP支持一些脚本语言,主要以VBScripp为主。与ASP相比较,你还可以选择另一中开放源代码编程语言——PHP,PHP可以运行在多种操作系统下,其中包括Linux和windows。
虽然ASP是一种不错的技术,但从长远考虑我相信PHP在将来的技术领域里会有不凡的表现。
我认为有七个理由可以说明PHP比ASP更优秀:
1、速度、速度、速度
当我第一次运行PHP脚本程序时,我不禁对自己说:“太快了”,当时我是在仪态166MHZ的机器上运行我的程序的,但运行的速度仍然很快。
ASP是永远也不会象PHP这样快的,因为ASP是建立在COM体系结构之上的。当用VBScript写ASP脚本时,实际上实在使用COM的对象,当向用户浏览器发送信息时,它用的是Response对象的write方法,当它访问数据库和文件系统的时候,它用的是其他的COM对象。这些COM对象的使用使运行速度下降。
在PHP代码中,所有的工作都运行在PHP的内存空间中,也就是说PHP不是基于COM对象的,所以的他的运行速度会快一些。
下面是我们在MSSQL7 40次运行一个查询语句的执行时间统计:
PHP Querying MSSQL7 时间(秒)
用 MSSQL extension 01.88
用 ODBC extension 09.54
用 ODBC via COM (ADO) 17.28
用 OLEDB via COM 06.19
当我们使用PHP.ODBC,访问数据库用了9.54秒,而用COM接口去连接数据库需要比PHP所用的时间高80%。
OLEDB是微软的一种高速访问数据库的技术,他比ODBC要快。但当我们所PHP和OLEDB的效率实验时,结果是PHP的整体性能比OLEDB高200%,如此的出一个结论,如果不采用COM可以获得较快的执行速度。
当然PHP的执行速度还不是最快的,但我们才刚刚开始起步,我们会逐步的完善他,而且PHP是一种开放源代码编程语言,世界上许多程序员在不断的完善他的技术,相信他一定会比非开放源代码系统获得更高的执行速度的。
2、高级内存管理
在IIS4下,一个ASP脚本header.asp,如果被20个页面所包含,那么运行的时候,在内存当中会保留这20个header.asp的编译副本,IIS5解决了这个问题,但只有windows2000才支持IIS5,由于这种IIS5的不能向下兼容的原因,许多服务器仍然要使用IIS4下的低级的内存管理。
而在PHP中,不会存在这种问题,只有当require时,才会调用某个include文件。
3、没有后顾之忧
我非常憎恨的一件事情就是会买到一件不放心的产品,比如当你买了一辆汽车,但由于发动机是坏的,你需要更换他;当你买了一栋房子的时候,你要去修补漏雨的屋顶。
那么ASP旧乡这些产品一样,当你买了ASP之后,如果你需要加密技术,你就要买ASPEncrypt;当你需要Email管理时,你就要买ServerObjets Qmail;当你需要文件上传时,你还要买Artisans SA-FileUp.
4、MySQL使PHP更精彩
PHP与MySQL的组合既简单又精彩。PHP有许多管理和维护MySQL的工具,对MySQk的支持是最全面的。许多有用的函数如mysql_insert_id和mysql_affected_rows等,其他的数据库则没有。
ASP和PHP都是中型网站的较理想的解决方案,但PHP与MySQL的紧密结合使PHP更加优越。
MySQL的虚度比Microsoft Access速度快,Mssql和Oracle速度比MySQL要快,可是费用较高。
5、Java和C++的变成风格
这个优点只是一个看法。
我知道你不会相信一个Visual Basic程序员会因为PHP有Java和C++的编程风格而转向使用PHP,但你会相信有许多人还是喜欢Java和C++的,PHP是一种具有这两种语言的编程风格的较容易学习的语言。
PHP支持结构化编程,在VB因为他的继承性使用类还是较少的。而PHP的象Java和C++一样的继承性使一个大型的程序中到处都充满了类的影子。
6、Bug的处理
你是否曾经要求Microsoft修改ASP的一些Bug呢?如果你不是一个象Boeing一样的组织,你无法获得迅速而恰当的修改,把么当你遇到Bug而停止工作时,如果这个Bug不修改,你将无法继续你的工作的。
PHP,当你发现Bug时,你可以修改他,如果你没有专家的水平,你可以请专家修改,并且你的修改会得到开放代码组织的接受和认可。
7、移植性
Microsoft经常修改ASP,下一版本叫ASP+,现在已经开始测试。我相信他们会修改许多我曾经提到过的问题。但也无庸质疑的,Microsoft会将你限制在他们的产品范围之内的。
我曾经是一个苹果机的程序员,当windows95问世后,我开始转变,但许多原来的代码都无法在windows95下运行,这些代码现在被放在一边,我非常的遗憾。所以我不希望在windows下再出现这样的悲剧。
不要忘记Novell曾经也象Microsoft的网络操作系统一样热及一时,但现在已经没有许多人用了,那么Microsoft也会这样的。
我找到了PHP,我仍旧在windows下工作,但我知道PHP代码可以运行在Solaris、Linux和许多其他的操作系统中,我的心里感到安慰。

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 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
