PHP Tutorial----Introductory Guide

Source: Internet
Author: User
Tags gtk php programming
What is PHP?


PHP ("Php:hypertext preprocessor", the acronym for Hypertext Preprocessor) is a widely used, open-source, multipurpose scripting language that can be embedded in HTML, especially for Web development.
The above is a simple answer, but what does it mean? Consider the following example:
Example #1 An introductory example

            Example                
  
       

Notice the difference between this example and other scripts written in C or Perl--unlike a large number of commands to write a program to output HTML, the PHP page is HTML, except that it embeds some code to do something (in this case, "Hi, I ' m a PHP scrip T! " )。 PHP code is included in the special starter and Terminator , allowing access to "PHP mode".


Unlike the client's JavaScript, the PHP code is running on the server. If a similar code is established on the server, the client will be able to receive the results after running the script, but they will not know how the code behind it works. You can even set the Web server to allow PHP to process all the HTML files, so that the user doesn't know what the servers are doing.
One of the great benefits of using PHP is that it is extremely simple for beginners and provides a variety of advanced features for professional programmers.

What can PHP do?


PHP can do anything. PHP is primarily used for server-side scripting, so you can use PHP to do the work that any other CGI program can do, such as collecting form data, generating dynamic Web pages, or sending/receiving Cookies. But PHP's capabilities are far from the limit.
PHP scripts are mainly used in the following three areas:
Server-side scripting. This is the most traditional and most important target area of PHP. This work requires the following three points: PHP parser (CGI or server module), Web server, and Web browser. You need to install and configure PHP when you run the Web server, and then you can use a Web browser to access the PHP program's output, which is to browse the PHP page on the service side. If you just experiment with PHP programming, all of this can be run in your own home computer. Please refer to the installation chapter for more information.
command-line scripting. You can write a PHP script and do not need any server or browser to run it. In this way, only the PHP parser is required to execute. This usage is ideal for scripts that rely on cron (Unix or Linux environments) or Task Scheduler (Windows environments) to run on a daily basis. These scripts can also be used to handle simple text. See the command-line mode for PHP for more information.
Writing desktop applications. PHP may not be the best language for desktop applications with graphical interfaces, but if the user is very proficient in PHP and wants to use some of the advanced features of PHP in the client application, you can use PHP-GTK to write these programs. In this way, you can also write cross-platform applications. PHP-GTK is an extension of PHP that is not included in the normally published PHP package. If you are interested in PHP-GTK, please visit them. Web site for more information.
PHP can be used on all major operating systems, including various variants of Linux, Unix (including HP-UX, Solaris, and OpenBSD), Microsoft Windows, Mac os X, RISC OS, and more. Today, PHP has supported most Web servers, including Apache, Microsoft Internet Information Server (IIS), Personal Web Server (PWS), Netscape, and IPlant Server, oreilly Website Pro server, Caudium, Xitami, OMNIHTTPD, and more. For most servers, PHP provides a module, and some PHP supports the CGI standard, allowing PHP to work as a CGI processor.
In summary, using PHP, you are free to choose the operating system and Web server. At the same time, you can also choose to use the face process and face the object, or the mixture of the two in the development. Although PHP 4 does not support all of OOP's standards, many code warehouses and large-scale applications (including the PEAR Library) are developed using only OOP code. PHP 5 makes up the weakness of PHP 4 by introducing a complete object model.
Using PHP is not limited to outputting HTML. PHP can also be used to dynamically output images, PDF files, and even Flash animations (using libswf and Ming). It is also very easy to output text, such as XHTML and any other form of XML file. PHP can automatically generate these files, creating a cache of dynamic content on the server, either by printing them directly or by storing them in a file system.
One of the most powerful and notable features of PHP is that it supports a wide range of databases. It is easy to write database-supported Web pages with any extensions to a database (for example, MySQL), or use an abstraction layer such as PDO, or connect to any ODBC-compliant database through an ODBC extension. Some other databases may also use CURL or sockets, such as CouchDB.
PHP also supports services that utilize countless protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, and COM (Windows environments). You can also open the original network port, allowing any other protocol to work together. WDDX complex data exchange between PHP support and all Web development languages. In connection with each other, PHP has supported an immediate connection to the Java object and can transparently use it as a PHP object.
PHP has extremely efficient text processing features, including Perl-compatible regular Expressions (PCRE), as well as many extensions and tools that can be used to parse and access XML documents. PHP standardizes all XML functions into a solid libxml2 extension, and also adds Simplexml,xmlreader and XMLWriter support to augment its functionality.
In addition, there are many other interesting extension libraries, which are listed by Alphabet and classification. Some additional PECL extensions may or may not be listed in the PHP manual, for example? Xdebug.

The above describes the PHP tutorial----Introductory Guide, including aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.