: This article mainly introduces the PHP Tutorial 00 ---- Getting Started Guide. if you are interested in the PHP Tutorial, please refer to it. What is PHP?
PHP ("PHP: Hypertext Preprocessor", short for Hypertext Preprocessor) is a widely used open-source multi-purpose scripting language that can be embedded into HTML, especially suitable for web development.
The above is a simple answer, but what does this mean? See the following example:
Example #1 an introductory Example
Example
Note the difference between this example and other scripts written in C or Perl-different from writing a program with a large number of commands to output HTML, the PHP page is HTML, but some code is embedded in it to do some things (in this example, "Hi, I'm a PHP script! "). PHP code is included in special start and end characters In PHP mode ".
Unlike JavaScript on the client, PHP code runs on the server. If a similar code is created on the server, the client can receive the result after running the script, but they cannot know how the code behind it works. You can even set the web server to allow PHP to process all HTML files, so that the user cannot know what the server has done.
One of the major advantages of using PHP is that it is extremely simple for beginners and provides various advanced features to professional programmers.
What can PHP do?
PHP can do anything. PHP is mainly used for script programs on the server end. Therefore, PHP can be used to complete the work that can be done by any other CGI program, such as collecting form data, generating dynamic webpages, or sending/receiving Cookies. However, PHP functions are far from limited.
PHP scripts are mainly used in the following three fields:
Server script. This is the most traditional and main target field of PHP. To do this, you must have the following three items: 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 PHP program output, that is, browse the PHP page of the server. If you only want to experiment with PHP programming, all these can run on your home computer. For more information, see the installation chapter.
Command line script. You can write a PHP script without any servers or browsers. In this way, only the PHP parser is required. This method is ideal for scripts that depend on cron (Unix or Linux environment) or Task Scheduler (Windows environment) for daily running. These scripts can also be used to process simple text. For more information, see The PHP command line mode.
Write a desktop application. For desktop applications with graphic interfaces, PHP may not be the best language, but if you are very proficient in PHP and want to use some advanced features of PHP in client applications, PHP-GTK can be used to write these programs. In this way, you can also compile cross-platform applications. The PHP-GTK is an extension of PHP and does not include it in a commonly published PHP package. If you are interested in a PHP-GTK, visit it? For more information.
PHP can be used on all mainstream operating systems, including Linux and Unix variants (including HP-UX, Solaris, and OpenBSD), Microsoft Windows, Mac OS x, and risc OS. Today, PHP supports most web servers, including Apache, Microsoft Internet Information Server (IIS), and Personal Web Server (PWS), Netscape, iPlant server, Oreilly Website Pro Server, Caudium, Xitami, OmniHTTPd, etc. For most servers, PHP provides a module, and some PHP supports CGI standards so that PHP can work as a CGI processor.
To sum up, the operating system and web server can be freely selected using PHP. At the same time, you can also choose to use the process-oriented and object-oriented approaches during development, or a mixture of the two methods for development. Although PHP 4 does not support all OOP standards, many code repositories and large applications (including PEAR libraries) only use OOP code for development. PHP 5 makes up for this weakness of PHP 4 and introduces a complete object model.
PHP is not limited to HTML output. PHP can also be used to dynamically output images, PDF files, and even Flash animations (using libswf and Ming ). It can also easily output text, such as XHTML and any other form of XML files. PHP can automatically generate these files, open a dynamic content cache on the server, and print them directly or store them in the file system.
One of the most powerful and notable features of PHP is that it supports a wide range of databases. It is very easy to write web pages supported by databases using any extension for a database (such as mysql), or use an abstraction layer such as PDO, or connect to any database that supports the ODBC standard through ODBC extension. Other databases may also use cURL or sockets, such as CouchDB.
PHP also supports services that use countless protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, and COM (Windows environment. You can also open the original network port so that any other protocols can work together. PHP supports WDDX complex data exchange with all web development languages. PHP supports instant connection to Java objects and can be transparently used as PHP Objects.
PHP has extremely effective text processing features, including Perl-compatible regular expressions (PCRE) and many extensions and tools for parsing and accessing XML documents. PHP has standardized all XML functions to a solid libxml2 extension, and added SimpleXML, XMLReader, and XMLWriter support to expand its functions.
There are also many other interesting extension libraries listed here by letter and category. Some additional PECL extensions may or may not be listed in the PHP manual, for example? XDebug.
The above introduces the PHP Tutorial 00 ---- Getting Started Guide, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.