Current location - Recipe Complete Network - Complete cookbook of home-style dishes - phplinux common commandslinuxphp command
phplinux common commandslinuxphp command

What are the main functions of PHP?

PHP can do anything. PHP is mainly used for server-side scripts, so you can use PHP to complete any work that other CGI programs can complete, such as collecting form data, generating dynamic web pages, or sending/receiving Cookies. But PHP's capabilities are far beyond this.

PHP scripts are mainly used in the following three areas:

(1) Server-side scripts. This is the most traditional and main target area of ??PHP. The following three points are required to carry out this work: PHP parser (CGI or server module), web server and web browser. You need to install and configure PHP when running the web server. Then, you can use a web browser to access the output of the PHP program, that is, browse the PHP page on the server. If you are just experimenting with PHP programming, all of this can be run on your home computer. Please consult the Installation chapter for more information.

(2) Command line script. You can write a PHP script and don't need any server or browser to run it. This way, only the PHP parser is needed to execute. This usage is ideal for daily running scripts that rely on cron (Unix or Linux environments) or TaskScheduler (Windows environments). These scripts can also be used to process simple text. See PHP's Command Line Mode for more information.

Write desktop applications. For desktop applications with graphical interfaces, PHP may not be the best language, but if the user is very proficient in PHP and wants to use some advanced features of PHP in client applications, they can use PHP-GTK to write these programs. Using this approach, you can also write cross-platform applications. PHP-GTK is an extension of PHP that is not included in the commonly released PHP packages.

(3) PHP can be used on all mainstream operating systems, including Linux, various variants of Unix (including HP-UX, Solaris and OpenBSD), Microsoft Windows, MacOSX, RISCOS, etc. Today, PHP already supports most web servers, including Apache, Microsoft Internet Information Server (IIS), Personal web Server (PWS), Netscape, iPlantserver, OreillyWebsiteProServer, Caudium, Xitami, OmniHTTPd, etc. For most servers, PHP provides a module; some PHP supports the CGI standard, allowing PHP to work as a CGI processor.

What is the PHP language?

PHP, a nested abbreviation name, is the abbreviation of English Hypertext Preprocessing Language (PHP: Hypertext Preprocessor). PHP is an HTML embedded language. PHP is quite similar to Microsoft's ASP. Both are scripting languages ??embedded in HTML documents that are executed on the server side. The style of the language is similar to the C language. It is now used by many It is widely used by website programmers. PHP's unique syntax mixes C, Java, Perl and PHP's own innovative syntax. It can execute dynamic web pages faster than CGI or Perl. Compared with other programming languages, dynamic pages made with PHP embed the program into the HTML document for execution, and the execution efficiency is much higher than CGI that completely generates HTML tags; compared with the scripting language JavaScript, which is also embedded in the HTML document In contrast, PHP is executed on the server side, making full use of the server's performance; the PHP execution engine will also store PHP programs that users frequently access in memory, so other users do not need to recompile the program when they access this program once. Just execute the code in the memory directly, which is also one of the manifestations of PHP's high efficiency. PHP has very powerful functions. All CGI or JavaScript functions can be implemented by PHP, and it supports almost all popular databases and operating systems. PHP was originally created by Rasmus Lerdorf in 1994. It started as a simple program written in Perl language to count visitors to his own website. Later it was rewritten in C language, including access to the database. In 1995, the first version was released as PersonalHomePageTools (PHPTools). Lerdorf wrote some documents introducing this program and released PHP1.0. In this early version, simple functions such as guest book and visitor counter were provided. In the future, more and more websites used PHP, and there was a strong need to add some features, such as loop statements and array variables, etc. After new members joined the development team, PHP 2.0 was released in mid-1995.

The second version is named PHP/FI (FormInterpreter). PHP/FI added support for mSQL, and has since established PHP's position in dynamic web development. By the end of 1996, there were 15,000 websites using PHP/FI; by mid-1997, the number of websites using PHP/FI exceeded 50,000. In mid-1997, the development plan for the third edition was started. The development team joined Zeev Suraski and Andi Gutmans, and the third edition was named PHP3. In 2000, PHP4.0 came out, which added many new features. Features of PHP include the following: Open source code: Virtually all PHP source code is available. PHP is free. Based on the server side: Since PHP is a script that runs on the server side, it can run under UNIX, LINUX, and WINDOWS. Embed HTML: Because PHP can embed HTML language, it is not difficult to learn. Simple language: PHP insists on scripting language as the main language, unlike Java, which is C++. High efficiency: PHP consumes considerably less system resources. Image processing: Use PHP to dynamically create images. Comparison between PHP3 and PHP4. PHP3 is closely integrated with the Apache server; in addition, it is constantly updated and adds new functions; and it supports almost all mainstream and non-mainstream databases; in addition, it can perform high-speed Due to its execution efficiency, PHP was used on more than 1.5 million sites in 1999. In addition, its source code is completely open to the public. Today, with the rise of OpenSource awareness, it is the mainstay in this area. The constant addition of new function libraries and the vitality of constant updates enable PHP to have more new functions whether on UNIX, LINUX or Windows platforms. It provides rich functions to provide better support in programming. The core of the entire script program in PHP4.0 has been significantly changed to allow the execution speed of the program to meet faster requirements. After optimization, the efficiency is better than that of traditional CGI or ASP programs. There are also stronger new functions and a richer function library. Whether you accept it or not, PHP will set off a revolutionary revolution in the field of WebCGI. For a professional WebMaster, it will also be one of the required courses. PHP4.0 is a more effective and reliable dynamic Web page development tool. It runs faster than PHP3.0 in most cases. Its script description is more powerful and more complex. The most significant feature is the increase in speed ratio. These excellent performances of PHP 4.0 are the result of the redesign of the PHP script engine: the engine was completely rewritten from the bottom up by Andi Gutmans and Zeev Suraski. The PHP4.0 script engine, the Zend engine, uses a more efficient compile-execution method instead of the execute-when-parsed model adopted by PHP3.0. PHP4 has added or enhanced many useful features based on version 3.0, mainly as follows: (1) Alias: In PHP4, you can use references to assign values ??to variables, which brings great flexibility to programming. (2) Expanded API module: PHP4.0 provides an extended PHP interface module for the extended API module, which is significantly faster than the old API version. Most of the existing and most commonly used interfaces of PHP modules have been converted to use this extended interface. (3) Automatic resource release: PHP4 adds a reference counting function. The introduction of this new technology enables PHP4 to have automatic memory management functions, reducing the burden on developers. (4) Boolean type: PHP4.0 supports Boolean type. (5) Process generation: PHP4.0 in the UNIX environment provides a very intelligent and versatile generation process, using a system generation technology based on automake/libtool. (6) COM/DCOM support: PHP4.0 provides COM/DCOM support (only for Windows environment) to seamlessly access and access COM objects. (7) Very good compatibility with PHP3.0: PHP4.0 is nearly 100% backward compatible with PHP3.0 code. Due to PHP4's improved architecture, there are some subtle differences, but most people will probably never encounter this situation. Introduction to PHP (8) Configuration: PHP4 redesigns and enhances PHP. ini file, which is made using PHP. ini to configure PHP is extremely easy. This file can be registered by Apache (unix system) or by Windows (Windows environment) at runtime. (9) Encryption support: PHP4 implements complete encryption. These encryption functions are a complete mycrypt library, and PHP4.0 supports hash functions. Blowfish, TripleDES, MD5, and SHA1 are also some of the encryption algorithms that can be used. (10) Type checking: PHP4.0 supports the same operator for type checking: === (3 equal sign operator), which checks between two values ??and their types. For example, 3===3 will be considered false (the types are different), while 3==3 (equality) will be considered true. (11) FTP support: PHP4.0 supports FTP.

Typically, you would provide an interface for downloading a large file over a modem connection. However, if you really need it, you can use PHP. (12) New functions or enhanced functions in PHP4: PHP4.0 has added many new functions and also enhanced many existing functions. Here are some examples. array_count_values()eval()foreach()nclude()ob_end_clean()ob_end_flush()ob_get_contents()ob_start()strip_tags()unset() (13) Here printing: PHP4.0's Here printing is similar to Perl, although completely Not the same. Here is a useful method for printing large-volume articles, such as HTML files, without missing any characters, such as table of contents tags. (14) HTTPSession fallback system: A fallback system for HTTPSession management is implemented in PHP4.0. By default, session identifiers are stored in cookies. If there is no cookie support or a cookie task fails, the Session identifier is automatically created and carried in the URL's query string. (15) ISAPI support: PHP4.0 can be used as a personalized ISAPI module as an IIS plug-in. This is more efficient than PHP 3.0, which runs as an external program. (16) Memory: PHP4.0 can use memory more efficiently, resulting in less memory consumption, mainly due to the implementation of reference counting technology. (17) Member functions of other classes: In PHP4.0, you can call member functions of other classes in the scope of the member function itself or in the global scope. For example, you can override a parent function with a child function and call the parent function in the child function. (18) Multidimensional arrays: In PHP4.0, data transmission using GET, POST, and Cookies supports multidimensional arrays. (19) Personalized HTTPSession support: HTTPSession processing, including fallback system management, is implemented by its new library function in PHP4.0. Handling Session in version 3.0 requires the use of PHPLIB and third-party library functions, which is much slower than having Session supported directly by PHP. (20) Personalized Java support: PHP4.0 supports interaction with java. This personalized Java support provides PHP with a simple and efficient tool for creating and using methods on Java objects. 21) Objects and number nested groups: PHP4.0 implements more powerful objects and removes various syntax restrictions that existed in PHP3.0. Objects can be nested within arrays and vice versa, depending on your needs. (22) Object-oriented programming: PHP4.0 provides extended functions and new features for object-oriented programming and constructing classes and objects. PHP4 implements new technologies such as object overloading and reference technology. (23) Object overloading support: Object overloading syntax allows third-party object-oriented class libraries to use the object-oriented features of PHP4 to access their own functions. A COM module using this feature has been implemented. (24) Output buffering support: PHP provides a collection of output buffering functions. Output buffering support allows you to write functions that wrap functions around compressed buffers. Output buffering support in PHP4 allows HTML header information to be stored regardless of whether the HTML body is output. Header information ((header(), contenttype, and cookies) does not use buffering. (25) Added PCRE library: PHP4.0 includes a Perl-compatible regular expression (PCRE) library, which is bundled with PHP together with the normal regex library. The split and replacePCRE functions are supported. There are some subtle differences between PCRE and Perl regular expressions. (26) PHP.ini file: The PHP.ini file is redesigned in PHP4.0, and the configuration of PHP.ini is more detailed. Easier and more efficient. All files can be manipulated by Apache at runtime (in an Apache environment) or by the Windows registry (under Windows). Configuration directives added to the PHP.ini file are automatically included in all relevant modules. Supported. (27) Reference counting: PHP4.0 provides a reference count for every value in the system, including resources. Once a resource is no longer referenced by any variable, it is automatically released to save memory resources. The most obvious example is a loop statement with a built-in SQL query. In PHP3.0, each time another SQL result set is recursed, the memory occupied by these result sets is not released until the script is executed (28). : The value of a variable can be changed by reference. (29) Runtime binding of functions: The runtime binding function of PHP4.0 allows you to call them before they are declared, regardless of whether the declaration is later in the code or at runtime.

(30) Class runtime information: PHP4.0 supports access to the following class information at runtime: the class name of an object, the class name of an object's parent class, and the name of the object's function. (31) Server abstraction layer: Provides an enhanced SAPI (server API) interface to support Web servers, which is an integral part of PHP4.0. This server abstraction layer provides universal WEB server interface support, supports multi-threaded WEB servers, and provides transparent support for most WEB servers, including Apache, IIS (ISAPI), and AOL servers. -------------------------------------------------- -------------------------------------------------- ----------------------------- New features of PHP5: The more object-oriented PHPPHP5 introduces a new object model (ObjectModel). A complete rewrite of the way PHP handles objects, allowing for better performance and more features. The core of PHP's object processing part has been completely redeveloped to provide more functions and improve performance. In previous versions of PHP, objects were handled the same way as basic types (numbers, strings). The disadvantage of this method is that when assigning the object to a variable or passing the object through parameters, the object will be completely copied. In the new version, the above operation will pass a reference (reference can be understood as an identifier of the object) instead of a value.