Php-manual's learning----"Getting Started Guide"

Source: Internet
Author: User
Tags learn php php script

June 27, 2017 17:03:53

Notes:
Brief introduction
What is PHP?
What can PHP do?
1.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.
2. For example:
<title>Example</title>
<body>

<?php
echo "Hi, I ' m a PHP script!";
?>

</body>
3. Unlike using 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 script!" )。 PHP code is included in special starter characters and Terminator <?php and?>, allowing access to "PHP mode".
Note: The PHP page is actually an HTML page.
4. The client's JavaScript is different, the PHP code is running on the server side. 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.
5. Although PHP has been developed for server-side scripting purposes, its functionality is far from limited.
6. 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.
Note: This is why a lot of people want to learn PHP, it is easy to get started, very easy to get started, high-speed development, but I want to become a more professional programmer.
7.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.
The main three areas of 8.PHP scripting:
Server-side scripting
Command-line scripting
Writing desktop applications
9. There are three requirements to browse the PHP page on the server: PHP parser (CGI or servers module), Web server, and Web browser.
10. With PHP, you have the freedom to choose your 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.
1. 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).
2.PHP also supports the use of services such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (Windows Environment), and countless other protocols.
A Concise tutorial
What do you need?
The first page of PHP
Useful scripts
Working with Forms
PHP code to use in a new version of PHP
What to do next?
3. Assuming that the user's server has been installed and running PHP, all files ending in. php will be processed by PHP. On most servers, this is the default extension for PHP, but please also ask the server administrator for confirmation. If the server supports PHP, you don't need to do anything. Simply build. php files and place them in a web directory, and the server will magically parse the files automatically. Instead of compiling anything, or installing any other tools, just think of these PHP files as simple HTML files, with just a new identifier, where you can do all sorts of things.
4. First PHP script: hello.php
<title>php Test </title>
<body>
<?php Echo ' <p>hello world</p> ';?>
</body>
5. Use <?php to indicate the beginning of the PHP identifier, and then put in the PHP statement and exit PHP mode by adding a terminating identifier?>
6. Print a variable (array element)
<?php
echo $_server[' http_user_agent '];
?>
7.strpos () is a built-in function of PHP that searches for another string in a string.
8. Mixed HTML and PHP mode
<?php
if (Strpos ($_server[' http_user_agent '), ' MSIE ')!== FALSE) {
?>
<p> using the Internet explorer</p>
<?php
} else {
?>
<center><b> not using the Internet explorer</b></center>
<?php
}
?>
Note: This approach I used in the project, in the HTML page needs to make some necessary judgments can be used in this way, efficiency and direct write HTML no difference.
9.PHP A very useful feature is reflected in the way it handles PHP forms. A very important principle to understand is that any element of the form automatically takes effect in the PHP script.
10.htmlspecialchars () makes the special characters in the HTML encoded correctly so that the user does not inject HTML tags or Javascript code into the page.

Php-manual's learning----"Getting Started Guide"

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.