php和mysql web开发外文翻译 (2)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

外文翻译-原文部分
Laura Thomson php and mysql web develop PHP is a scripting language originally designed for producing dynamic web pages It has evolved to include a command line interface capability and can be used in standalone graphical applications.
While PHP was originally created by Rasmus Lerdorf in 1995, the main implementation of PHP is now produced by The PHP Group and serves as the de facto standiird for PHP as there is no formal specification. PHP is free software released under the PHP License, however it is incompatible with the GNU General Public License (GPL), due to restrictions on the usage of the term PHP.
PHP is a widely-used general-purpose scripting language that is especially suited for web development and can be embedded into HTML. It generally runs on a web server, taking PHP code as its input and creating web pages as output. It can be million websites and 1 million web servers.
PHP originally stood for Personal Home Page, It began in 1994 as a set of Common Gateway Interface binaries written in the C programming language by the Danish/Greenlandic programmer Rasmus Lerdorf. Lerdorf initially created these Personal Home Page Tools to replace a small set of Perl scripts he had been using to maintain his personal homepage. The tools were used to perform tasks such as displaying his rdsum^ and recording how much traffic his page was receiving. He combined these binaries with his Fonn Interpreter to create PHP/FI, which had more functionality. PHP/FI included a larger implementation for the C programming language and could communicate with databases, enabling the building of simple, dynamic web applications. lerdorf released PHP publicly on June 8,1995 to accelerate bug location and improve the code.This release was named PHP version 2 and already had the basic functionality that PHP has today. This included Perl-like variables, form handling, and the ability to embed HTML. The syntax was similar to Perl but was more limited, simpler, and less consistent.
Zeev Suraski and Andi Gutmans,two Israeli developers at the Technion IIT,
rewrote the parser in 1997 and formed the base of PHP 3, changing the language's name to the recursive initialism PHP: Hypertext Preprocessor. The development team officially released PHP/FI 2 in November 1997 after months of beta testing. Afterwards, public testing of PHP 3 began, and the official launch came in June 1998. wSuraski and Gutmans then started a new rewrite of PHP's core, producing the Zend Engine in 1999. They also founded Zend Technologies in Ramat Gan, Israel.
On May 22, 2000, PHP 4, powered by the Zend Engine 1 •0, was released. On July 13, 2004, PHP 5 was released, powered by the new Zend Engine II. PHP 5 included new features such as improved support for object-oriented programming, the PHP Data
Objects extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements. The most recent update released by The PHP Group is for the older PHP version 4 code branch. As of August, 2008 this branch is up to version 4.4.9. PHP 4 is no longer under development nor will any security updates be released.
In 2008, PHP 5 became the only stable version under development. Late static binding has been missing from PHP and will be added in version 5.3. PHP 6 is under development alongside PHP 5. Major changes include the removal of register_globals,magic quotes, and safe mode. The reason for the removals was because register_globals had given way to security holes,and magic quotes had an unpredictable nature, and was best avoided. Instead, to escape characters, magic quotes may be substituted with the addslashes() function, or more appropriately an escape mechanism specific to the database vendor itself like mysql_rcal_escape_string() for MySQL.
PHP does not have complete native support for Unicode or multibyte strings; Unicode support will be included in PHP 6. Many high profile open source projects ceased to support PHP 4 in new code as of February 5, 2008, due to the Go PHP 5 initiative, provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 1397 It runs in both 32-bit and 64-bit environments, but on Windows the only official distribution is 32-bit, requiring Windows 32-bit compatibility mode to be enabled while using IIS in a 64-bit Windows environment. There is a third-party
distribution available for 64-bit Windows.
PHP is a general-purpose scripting language that is especially suited for web development. PHP generally runs on a web server, taking PHP code as its input and creating web pages as output. It can also be used for command-line scripting and client-side GUI applications. PHP can be deployed on most web servers, many operating systems and platforms, and can be used with many relational database management systems. It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.
PHP primarily acts as a filter, taking input from a file or stream containing text and/or PHP instructions and outputs another stream of data; most commonly the output will be HTML. It can automatically detect the language of the user. From PHP 4, the PHP parser compiles input to produce bylecode for processing by the Zend Engine, giving improved performance over its interpreter predecessor.
Originally designed to create dynamic web pages,PHP’s principal focus is server-side scripting, and it is similar to other server-side scripting languages that provide dynamic content from a web server to a client, such as Microsoft’s Active Server Pages, Sun Microsystems1 JavaServer Pages, and mod_perl. PHP has also attracted the development of many frameworks that provide building blocks and a design structure to promote rapid application development (RAD). Some of these include CakePHP, Symfony, Codeigniter, and Zend Framework, offering features similar to other web application frameworks-
The LAMP architecture has become popular in the web industry as a way of deploying vveb applications. PHP is commonly used as the P in this bundle alongside Linux, Apache and MySQL, although the P may also refer to Python or Perl.
As of April 2007, over 20 million Internet domains were hosted on servers with PHP installed, and PHP was recorded as the most popular Apache module. Significant websites arc written in PHP including the user-facing portion of Faccbook, Wikipedia , PHP can be used to create stand-alone, compiled applications and libraries, it can be used for shell scripting, and the PHP binaries can be called from the command line.
As with many scripting languages,PHP scripts are normally kept as human-readable source code, even on production web servers. In this case, PHP
scripts will he compiled at runtime by the PHP engine, which increases their execution time. PHP scripts are able to be compiled before runtime using PHP compilers as with other programming languages such as C (the language PHP and its extensions are written in).
Code optimizers aim to reduce the computational complexity of the compiled code by reducing its size and making other changes that can reduce the execution time with the overall goal of improving performance. The nature of the PHP compiler is such that there are often opportunities for code optimization, and an example of a code optimizer is the Zend Optimizer PHP extension.
Another approach for reducing overhead for high load PHP servers is using PHP accelerators. These can offer significant performance gains by caching the compiled form of a PHP script in shared memory to avoid the overhead of parsing and compiling the code every time the script runs.
The National Vulnerability Database stores all vulnerabilities found in computer software. The overall proportion of PHP-related vulnerabilities on the database amounted to: 12% in 2003, 20% in 2004, 28% in 2005, 43% in 2006, 36% in 2007, and 35% in 2008. Most of these PHP-related vulnerabilities can be exploited remotely: they allow hackers to steal or destroy data from data sources linked to the Webserver (such as an SQL database),send spam or contribute to DOS attacks using malware,which itself can be installed on the vulnerable servers.
These vulnerabilities arc caused mostly by not following best practice programming rules: technical security flaws of the language itself or of its core libraries are not frequent. Recognizing that programmers cannot be trusted, some languages include taint checking to detect automatically the lack of input validation which induces many issues. Such a feature is being developed for PHP. Allhough it may be included in mainstream PHP in a future release, its inclusion has been rejected several times in the past.
Hosting PHP applications on a server requires a careful and constant attention to deal with these security risks. There are advanced protection patches such as vSuhosin and Hardening-Patch, especially designed for web hosting environments. Installing PHP as a CGI binary rather than as an Apache module is the preferred method for
added security.
With respect to securing the code itself, PHP code can be obfuscated to make it difficult to read while remaining functional.
Syntax-highlighted PHP code embedded within HTMLPHP only parses code within its delimiters. Anything outside its delimiters is sent directly to the output and is not parsed by PHP. The most common delimiters are <?php and ?>, which are open and close delimiters respectively.〈script language="php"> and </script> delimiters are also available. Short tags can be used to start PHP code, <? or <?= (which is used to echo back a string or variable) and the tag to end PHP code, ?>. These tags arc commonly used,but like ASP-style tags (<% or <%= and %>),they are less portable as they can be disabled in the PHP configuration. For this reason, the use of short tags and ASP-style tags is discouraged. The puipose of these delimiters is to separate PHP code from non-PHP code,including HTML.
Variables arc prefixed with a dollar symbol and a type docs not need to be specified in advance. Unlike function and class names, variable names are case sensitive. Both double-quoted (“”) and heredoc strings allow the ability to embed a variable's value into the string. PHP treats newlines as whitespace in the manner of a free-form language (except when inside string quotes), and statements are terminated by a semicolon. PHP has three types of comment syntax: /* */ serves as block comments, and // as well as # are used for inline comments. The echo statement is one of several facilities PHP provides to output text (e.g. to a web browser).
In terms of keywords and language syntax, PHP is similar to most high level languages that follow the C style syntax. If conditions, for and while loops, and function returns arc similar in syntax to languages such as C, C++, Java and Perl.
PHP stores whole numbers in a platform-dependent range. This range is typically that of 32-bit signed integers. Unsigned integers are converted values in certain situations; this behavior is different from other programming languages.Integer variables can be assigned using decimal (positive and negative), octal, and hexadecimal notations- Floating point numbers arc also stored in a platform-specific range. They can be specified using floating point notation, or two forms of scientific notation. PHP has a native Boolean type that is similar to the native Boolean types in
Java and C++. Using the Boolean type conversion rules,non-zero values are interpreted as true and zero as false, as in Perl and C++.The null dala type represents a variable that has no value. The only value in the null data type is NULL. Variables of the nresourceM type represent references to resources from external sources. These are typically created by functions from a particular extension, and can only be processed by functions from the same extension; examples include file, image, and database resources. Arrays can conlain elements of any type thal PHP can handle, including resources, objects, and even other arrays. Order is preserved in lists of values and in hashes with both keys and values, and the two can be intermingled. PHP also supports strings, which can be used with single quotes, double quotes, or heredoc syntax.
The Standard PHP Library (SPL) attempts to solve standard problems and implemenls efficient data access interfaces and classes.
PHP has hundreds of base functions and thousands more via extensions. These functions are well documented on the PHP site, but unfortunately, the built-in library has a wide variety of naming conventions and inconsistencies. PHP currently has no functions for thread programming.
Functions are not first-class functions and can only be referenced by their name—directly or dynamically by a variable containing the name of the function.
User-defined functions can be created at any time without being prototyped. Functions can be defined inside code blocks, permitting a run-time decision as to whether or not a function should be defined. Function calls must use parentheses, with the exception of zero argument class constructor functions called with the PHP new operator, where parentheses are optional. PHP supports quasi-anonymous functions through the create_function() function, although they are not true anonymous functions because anonymous functions are nameless, but functions can only be referenced by name, or indirectly through a variable $runction_name(); in PHP.
PHP gained support for first-class functions and closures. True anonymous functions are supported using the following syntax:
function getAdder($x)
{
return function ($y) use ($x) {
return $x + $y;
};
}
Sadder = getAdder(8);
echo $adder(2); // prints ”10"
Here, gctAddcr() function creates a closure using parameter $x (keyword “use” forces getting variable from context), which, etc. For more details see Lambda functions and closures RFC.
Basic object-oriented programming functionality was added in PHP 3 and improved in PHP 4.|3| Object handling was completely rewritten for PHP 5, expanding the feature set and enhancing performance. In previous versions of PHP, objects were handled like primitive types. The drawback of this method was that the whole object was copied when a variable was assigned or passed as a parameter to a method. In the new approach, objects are referenced by handle, and not by value. PHP 5 introduced private and protecled member variables and methods, along with abstract classes and final classes as well as abstract methods and final methods. It also introduced a standard way of declaring constructors and destructors, similar to that of other object-oriented languages such as C++, and a standard exception handling model. Furthermore, PHP 5 added interfaces and allowed for multiple interfaces to be implemented. There are special interfaces that allow objects to interact with the runtime system. Objects implementing ArrayAcccss can be used with array syntax and objects implementing Iterator or IteratorAggregate can be used with the foreach language construct. There is no virtual table feature in the engine, so static variables are bound with a name instead of a reference at compile time.
If the developer creates a copy of an object using the reserved word clone, the Zend engine will check if a _clonc() method has been defined or not. If not, it will call a default _clone() which will copy the object's properties. If a _clone() method is defined, then it will be responsible for setting the necessary properties in the created object. For convenience, the engine will supply a function that imports the properties of the source object, so that the programmer can start with a by-value replica of the
source object and only override properties that need to be changed.
PHP includes free and open source libraries with the core build. PHP is a fundamentally Internet-aware system with modules built in for accessing.
FTP servers, many database servers, embedded SQL libraries such as embedded PostgreSQL, MySQL and SQLite, LDAP servers, and others. Many functions familiar to C programmers such as those in the stdio family are available in the standard PHP build. PHP has traditionally used features such as ’’magic_quotes_gpc” and “magic_quotcs_runti me” whic h attempt to escape apostrophes (‘) and quotes (‘’) in strings in the assumption that they will be used in databases, to prevent SQL injection attacks. This leads to confusion over which data is escaped and which is not, and to problems when data is not in fact used as input to a database and when the escaping used is not completely correct.|68| To make code portable between servers which do and do not use magic quotes, developers can preface their code with a script to reverse the effect of magic quotes when it is applied.
PHP allows developers to write extensions in C to add functionality to the PHP language. These can then be compiled into PHP or loaded dynamically at runtime. Extensions have been written to add support for the Windows API, process management on Unix-likc operating systems, multibytc strings (Unicode), cURL, and several popular compression formats. Some more unusual features include integration with Internet Relay Chat, dynamic generation of images and Adobe Flash content, and even speech synthesis. The PHP Extension Community Library (PECL) project is a repository for extensions to the PHP language.Zend provides a certification exam for programmers to become certified PHP developers.
外文翻译-译文部分
php和mysql web开发
PHP是最初设计用于生成动态网页的脚本语言,它已经演变成包括命令行界
面功能,可以在独立的图形应用程序中使用。

虽然PHP最初是由Rasmus Lerdorf于1995年创建的,但PHP的主要实现现在由PHP集团生产,并且作为PHP的事实上的平台,因为没有正式的规范。

PHP 是根据PHP许可证发布的免费软件,但由于使用术语PHP的限制,它与GNU 通用公共许可证(GPL)不兼容。

PHP是广泛使用的通用脚本语言,特别适用于Web开发,可以嵌入到HTML 中。

它通常在Web服务器上运行,以PHP代码作为输入,并创建网页作为输出。

它可以是百万个网站和一百万个Web服务器。

PHP最初代表个人主页,它始于1994年,是丹麦/格陵兰编程人员Rasmus Lerdorf以C编程语言编写的一套Common Gateway Interface二进制文件。

Lerdorf最初创建了这些个人主页工具,以取代他一直在使用的一小段Perl脚本来维护他的个人主页。

这些工具用于执行任务,如显示他的rdsum ^并记录他的页面接收的流量。

他将这些二进制文件与他的Fonn Interpreter结合起来,以创建具有更多功能的PHP / FI。

PHP / FI包括一个更大的C编程语言实现,并可以与数据库进行通信,从而构建简单,动态的Web应用程序。

lerdorf于1986年6月8日公开发布PHP,以加速错误位置并改进代码。

该版本被命名为PHP版本2,并且已经具有PHP现在的基本功能。

这包括Perl类变量,表单处理以及嵌入HTML的能力。

语法类似于Perl,但是更有限,更简单,更不一致。

Techni IIT的两位以色列开发商Zeev Suraski和Andi Gutmans在1997年重写了解析器,形成了PHP 3的基础,将语言的名称改为递归初始化PHP:超文本预处理器。

开发团队经过数月的beta测试,于1997年11月正式发布了PHP / FI 2。

之后,PHP 3的公开测试开始,并于1998年6月正式发布.WSuraski和Gutmans 于1999年开始重新编写PHP的核心,生产Zend Engine。

他们还在以色列的Ramat Gan建立了Zend Technologies。

2000年5月22日,由Zend Engine 1•0驱动的PHP 4发布。

2004年7月13日,PHP 5由新的Zend Engine II发布。

PHP 5包括新功能,如改进对面向对象编程的支持,PHP数据对象扩展(定义了访问数据库的轻量级和一致的界面),以及众多的性能增强。

PHP组发布的最新更新是针对较旧的PHP版本4代码分支。

截至2008年8月,该分支机构达4.4.9。

PHP 4不再在开发中,也不会发布任何安全更新。

2008年,PHP 5成为唯一正在开发的稳定版本。

PHP中缺少静态绑定,5.3版将添加静态绑定。

PHP 6正在与PHP 5一起开发。

主要更改包括
删除register_globals,魔术引号和安全模式。

删除的原因是因为register_globals 已经让位于安全漏洞,而魔术引用具有不可预测的性质,最好避免。

相反,为了转义字符,可以用addslashes()函数替代魔术引号,或者更适当地使用特定于数据库供应商本身的转义机制,如MySQL的mysql_rcal_escape_string()。

PHP对Unicode或多字节字符串没有完整的原生支持; Unicode支持将被包含在PHP 6中。

由于Go PHP 5计划,由PHP开发人员协会提供的PHP开发人员提供的许多高调的开源项目在2008年2月5日的新代码中停止支持PHP 4到PHP 1397它运行在32位和64位环境中,但在Windows上,唯一的官方分发是32位,要求在64位Windows环境中使用IIS时启用Windows 32位兼容模式。

有64位Windows可用的第三方发行版。

PHP是一种通用的脚本语言,特别适用于Web开发。

PHP通常在Web服务器上运行,以PHP代码作为输入,并创建网页作为输出。

它也可以用于命令行脚本和客户端GUI应用程序。

PHP可以部署在大多数Web服务器,许多操作系统和平台上,并且可以与许多关系数据库管理系统一起使用。

它是免费的,PHP 集团提供完整的源代码,供用户构建,自定义和扩展以供自己使用。

PHP主要作为过滤器,从包含文本和/或PHP指令的文件或流中输入,并输出另一个数据流;最常见的输出是HTML。

它可以自动检测用户的语言。

从PHP 4开始,PHP解析器编译输入以生成由Zend Engine进行处理的分解,从而提高了其解释器前身的性能。

最初设计用于创建动态网页,PHP的主要重点是服务器端脚本,它类似于提供从Web服务器到客户端的动态内容的其他服务器端脚本语言,例如Microsoft 的Active Server Pages,Sun Microsystems1 JavaServer Pages和mod_perl。

PHP 还吸引了许多框架的开发,提供构建块和设计结构来促进快速应用程序开发(RAD)。

其中一些包括CakePHP,Symfony,Codeigniter和Zend Framework,提供与其他Web应用程序框架相似的功能。

LAMP架构在网络行业中已经成为部署vveb应用程序的一种方式。

PHP通常用作Linux,Apache和MySQL中的P包,尽管P也可能指Python或Perl。

截至2007年4月,在安装PHP的服务器上托管了超过2000万个互联网域,PHP被记录为最受欢迎的Apache模块。

重要的网站用PHP编写,包括Faccbook 的面向用户的部分,维基百科,PHP可以用于创建独立的,编译的应用程序和库,它可以用于shell脚本,并且可以从命令调用PHP二进制文件线。

与许多脚本语言一样,PHP脚本通常保存为人类可读的源代码,即使在生产Web服务器上也是如此。

在这种情况下,PHP脚本将在运行时由PHP引擎编译,从而增加了执行时间。

PHP脚本可以在运行前使用PHP编译器进行编译,如其他编程语言,如C(语言PHP及其扩展名)。

代码优化器旨在通过减小编译代码的大小和进行其他可以减少执行时间的更改来降低编译代码的计算复杂性,从而提高性能的总体目标。

PHP编译器的性质是经常有机会进行代码优化,代码优化器的一个例子是Zend Optimizer PHP 扩展。

另一种降低高负载PHP服务器开销的方法是使用PHP加速器。

通过将PHP 脚本的编译形式缓存在共享内存中,可以提供显着的性能提升,以避免每次脚本运行时解析和编译代码的开销。

国家漏洞数据库存储计算机软件中发现的所有漏洞。

数据库中PHP相关漏洞的总体比例为:2003年为12%,2004年为20%,2005年为28%,2006年为43%,2007年为36%,2008年为35%。

大部分PHP-相关的漏洞可以远程利用:它们允许黑客从连接到Webserver(例如SQL数据库)的数据源窃取或销毁数据,发送垃圾邮件或使用恶意软件进行DOS攻击,恶意软件本身可以安装在易受攻击的服务器上。

这些漏洞主要是由于不遵循最佳实践规划规则:语言本身或其核心库的技术安全缺陷并不频繁。

认识到程序员不能被信任,一些语言包括污染检查,以自动检测引起许多问题的缺乏输入验证。

正在为PHP开发此类功能。

所以在未来的版本中,它可能被包含在主流PHP中,其包含过去已经被拒绝了几次。

在服务器上托管PHP应用程序需要谨慎和不断的关注来处理这些安全风险。

有先进的保护补丁,如vSuhosin和Hardening-Patch,特别适用于虚拟主机环境。

将PHP作为CGI二进制文件而不是Apache模块安装是增加安全性的首选方法。

关于保护代码本身,PHP代码可能被模糊化,使其难以阅读,同时保持功能。

HTMLPHP中嵌入的语法高亮显示的PHP代码只能对其分隔符中的代码进行解析。

其分隔符之外的任何内容都直接发送到输出,不会被PHP解析。

最常见的分隔符是<?php和?>,它们分别是打开和关闭的分隔符。

<script language =“php”>和</ script>分隔符也可用。

短标签可以用来启动PHP代码,<?或<?=(用于回显字符串或变量)和标签结束PHP代码,?>。

这些标签通常使用,但像ASP 样式的标签(<%或<%=和%>),它们不太可移植,因为它们可以在PHP配置中
禁用。

因此,不建议使用短标签和ASP样式的标签。

这些分隔符的行为是将PHP 代码与非PHP代码(包括HTML)分开。

变量以美元符号为前缀,并且不需要提前指定类型文档。

与函数和类名不同,变量名称区分大小写。

双引号(“”)和heredoc字符串都允许将变量的值嵌入到字符串中。

PHP以空格形式的语言(除了内部字符串引号之外)将换行符视为空格,语句以分号终止。

PHP有三种类型的注释语法:/ * * /作为块注释,//以及#用于内联注释。

echo语句是PHP为输出文本(例如Web浏览器)提供的几种功能之一。

在关键字和语言语法方面,PHP类似于遵循C风格语法的大多数高级语言。

如果条件,for和while循环和函数返回在语法上类似于C,C ++,Java和Perl 等语言。

PHP将整数存储在与平台相关的范围内。

该范围通常为32位有符号整数。

无符号整数在某些情况下是转换值;这种行为与其他编程语言不同。

可以使用十进制(正和负),八进制和十六进制符号来分配整数变量- 浮点数字弧也存储在平台特定的范围内。

它们可以使用浮点表示法或两种形式的科学符号来指定。

PHP具有与Java和C ++中的原生布尔类型相似的本机布尔类型。

使用布尔类型转换规则,非零值被解释为真,零为零,如Perl和C ++中所示。

空dala类型表示一个没有值的变量。

空数据类型中唯一的值为NULL。

nresourceM类型的变量表示来自外部来源的资源的引用。

这些通常由来自特定扩展的函数创建,并且只能由来自相同扩展名的函数来处理;示例包括文件,图像和数据库资源。

数组可以包含PHP可以处理的任何类型的元素,包括资源,对象,甚至其他数组。

顺序保存在值列表中,并且具有键和值的哈希值,并且两者可以混合。

PHP还支持字符串,可以使用单引号,双引号或heredoc语法。

标准PHP库(SPL)尝试解决标准问题并实施高效的数据访问接口和类。

PHP有数百个基本功能,还有数千个扩展。

这些功能在PHP站点上有很好的记录,但不幸的是,内置库有各种各样的命名约定和不一致。

PHP目前没有线程编程的功能。

函数不是第一类函数,只能由名称引用,直接或动态地包含一个包含函数名称的变量。

可以随时创建用户定义的功能,而无需进行原型制作。

函数可以在代码块内定义,允许运行时决定是否定义函数。

函数调用必须使用括号,除了使用PHP 新操作符调用的零参数类构造函数,其中括号是可选的。

PHP通过create_function()函数支持准匿名函数,尽管它们不是真正的匿名函数,因为
匿名函数是无名的,但函数只能通过名称引用,或在PHP中通过变量$ runction_name()间接引用;PHP获得了一流的功能和关闭的支持。

使用以下语法支持真正的匿名函数:
function getAdder($ x)
{
return function($ y)use($ x){
return $ x + $ y;
};
}
Sadder = getAdder(8);
echo $ adder(2); //打印“10”
这里,gctAddcr()函数使用参数$ x(关键字“使用”强制从上下文获取变量)创建一个闭包,等等。

有关更多详细信息,请参阅Lambda函数和闭包RFC。

PHP 3中增加了基本的面向对象编程功能,并在PHP 4中进行了改进对象处理完全重写为PHP 5,扩展功能集和提高性能。

在以前的PHP版本中,对象被处理为原始类型。

该方法的缺点是当将变量作为参数分配或传递给方法时,整个对象被复制。

在新方法中,对象由句柄引用,而不是由值引用。

PHP 5引入了私有和保护的成员变量和方法,以及抽象类和最终类,以及抽象方法和最终方法。

它还引入了一种声明构造函数和析构函数的标准方法,类似于其他面向对象语言(如C ++)和标准异常处理模型。

此外,PHP 5添加了接口并允许实现多个接口。

有一些允许对象与运行时系统进行交互的特殊接口。

实现ArrayAcccss的对象可以与数组语法一起使用,实现Iterator或IteratorAggregate的对象可以与foreach 语言结构一起使用。

在引擎中没有虚拟表功能,因此在编译时,静态变量将绑定一个名称而不是引用。

如果开发人员使用保留单词克隆创建对象的副本,则Zend引擎将检查是否已经定义了_clonc()方法。

如果没有,它将调用默认的_clone(),这将复制对象的属性。

如果定义了_clone()方法,那么它将负责在创建的对象中设置必要的属性。

为方便起见,引擎将提供导入源对象的属性的函数,以便程序员可以使用源对象的副作用副本启动,并且仅覆盖需要更改的属性。

PHP包含具有核心构建的免费和开源库。

PHP是一个基本的互联网感知系统,内置模块用于访问。

FTP服务器,许多数据库服务器,嵌入式SQL库,如嵌入式PostgreSQL,MySQL和SQLite,LDAP服务器等。

C程序员熟悉的诸如stdio系列中的许多功能都可以在标准的PHP构建中使用。

传统上,PHP已经使用诸如“magic_quotes_gpc”和“magic_quotcs_runtime”这样的功能,它们假设它们将被用于数据库中,以避免SQL注入攻击,试图在字符串中避免撇号(')和引号('')。

这导致对哪些数据进行转义,哪些不是,以及数据实际上不用作数据库的输入以及使用的转义是不完全正确的问题造成的混淆。

为了使代码在不使用魔术引号的服务器之间移植,开发人员可以使用脚本来引用他们的代码,以在应用魔术引号时反转它们的效果。

PHP允许开发人员在C中编写扩展以向PHP语言添加功能。

这些可以被编译成PHP或在运行时动态加载。

已经编写了扩展以增加对Windows API的支持,Unix-likec操作系统上的进程管理,多字节字符串(Unicode),cURL和几种流行的压缩格式。

一些更不寻常的功能包括与互联网中继聊天,动态生成图像和Adobe Flash内容,甚至语音合成。

PHP扩展社区库(PECL)项目是用于扩展PHP语言的存储库.Zend为程序员提供认证考试,以成为认证的PHP开发人员。

相关文档
最新文档