PHP Foundation Hardening--Introduction

Source: Internet
Author: User
Tags gtk php introduction php programming php script

PHP Introduction: What is PHP?

What is PHP, which is a widely used, open-source, multipurpose scripting language that can be used to develop server-side scripts, command-line scripts, and desktop applications that are currently used primarily for web development.

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:

PHP         Echo "Hi, I ' m a PHP script!" ;        ? >    

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 special starter characters and Terminator <?php and?>, 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. Don't be afraid when you see a list of PHP's long features. You can quickly get started by writing simple scripts on your own in just a few hours.

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.
    • 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.
    • 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.
2.3 First PHP interface
Echo

Enter the URL of the Web server in the address bar of the browser to access this file, and add "/hello.php" at the end. If developed locally, this URL is typically http://localhost/hello.php or http://127.0.0.1/hello.php, depending on the settings of the Web server. If all the settings are correct, then the file will be parsed by PHP and the following results will be output in the browser:

The program is so simple that it just uses the Echo statement from PHP to show Hello world. Users must not be satisfied with this. Please note that the file does not need to be executed or specified in any way. The server will find the file and provide PHP with an explanation, because the ". PHP" extension is used, and the server is configured to automatically pass files with the ". php" extension to PHP. An ordinary HTML file, plus a few special tags, you can do a lot of very interesting things!

PHP Foundation Hardening--Introduction

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.