Home > Backend Development > PHP Tutorial > PHP Tutorial 00----Getting Started Guide

PHP Tutorial 00----Getting Started Guide

WBOY
Release: 2016-08-08 09:22:50
Original
960 people have browsed it

What is PHP?


PHP ("PHP: Hypertext Preprocessor", abbreviation for Hypertext Preprocessor) is a widely used open source multi-purpose scripting language that can be embedded into HTML and is especially suitable for web development.
The above is a simple answer, but what does it mean? Please see the following example:
Example #1 An introductory example

<span style="font-size:18px;"><html>
    <head>
        <title>Example</title>
    </head>
    <body>

        <?php
        echo "Hi, I&#39;m a PHP script!";
        ?>

    </body>
</html></span>
Copy after login

Please note the difference between this example and other scripts written in C or Perl language - compared with writing a program with a large number of commands to output The difference with HTML is that a PHP page is just HTML with some code embedded in it to do something (in this case it outputs "Hi, I'm a PHP script!"). PHP code is enclosed in special start and end characters , making it possible to enter and exit "PHP mode".

Different from client-side JavaScript, PHP code runs on the server side. If you build code similar to the example above on the server, after running the script, the client will receive the results, but they will have no way of knowing how the code behind it works. You can even set up the web server to let PHP handle all HTML files, so the user has no way of knowing what the server is doing.
One of the great benefits of using PHP is that it is extremely simple for beginners, while also providing a variety of advanced features for professional programmers.

What can PHP do?


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 do, such as collecting form data, generating dynamic web pages, or sending/receiving Cookies. But PHP’s capabilities go far beyond that.
PHP scripts are mainly used in the following three areas:
Server-side scripts. This is the most traditional and main target area of ​​PHP. Three things are required to do this: a PHP parser (CGI or server module), a web server, and a 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're just experimenting with PHP programming, all of this can be run on your home computer. Please consult the Installation chapter for more information.
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 Task Scheduler (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 distributed PHP packages. If you are interested in PHP-GTK, visit its website for more information.
PHP can be used on all major operating systems, including Linux, various variants of Unix (including HP-UX, Solaris, and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, etc. Today, PHP supports 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 wait. For most servers, PHP provides a module; some PHP supports the CGI standard, allowing PHP to work as a CGI processor.
In summary, using PHP, you can freely choose the operating system and web server. At the same time, you can also choose to use process-oriented, object-oriented, or a mixture of the two during development. Although PHP 4 does not support all OOP standards, many code repositories and large applications (including the PEAR library) are developed using only OOP code. PHP 5 makes up for this weakness of PHP 4 and introduces 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 possible to easily output text such as XHTML and any other form of XML file. PHP can automatically generate these files, open up a cache of dynamic content on the server, and print them out directly, or store them in the file system.
One of the most powerful and notable features of PHP is its support for a wide range of databases. It is very simple to write database-backed web pages using any extension for a certain database (such as mysql), or use an abstraction layer such as PDO, or connect to any database that supports the ODBC standard through the ODBC extension. Some other databases may also use cURL or sockets, such as CouchDB.
PHP also supports services utilizing protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (Windows environment) and countless others. Raw network ports can also be opened so that any other protocol can work together. PHP supports WDDX complex data exchange between all web development languages. Regarding inter-connections, PHP already supports on-the-fly connections to Java objects and can transparently use them as PHP objects.
PHP has extremely efficient text processing features, including Perl Compatible Regular Expressions (PCRE) and many extensions and tools for parsing and accessing XML documents. PHP standardizes all XML functionality into the solid libxml2 extension, and also adds SimpleXML, XMLReader and XMLWriter support to expand its functionality.
In addition, there are many other interesting extension libraries, which are listed here according to letters and categories. There are also some additional PECL extensions that may or may not be listed in the PHP manual, such as ?XDebug.

The above introduces the PHP Tutorial 00 - Getting Started Guide, including the relevant content. I hope it will be helpful to friends who are interested in PHP Tutorial.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template