Php basics (super practical) and basic knowledge

Source: Internet
Author: User
Tags php basics what php

Php basics (super practical) and basic knowledge

Many people think that PHP is a programmer and think that there is a lot of money (although it is a fact), but they also need to consider whether they are suitable for this line. Do you know what PHP is? What functions does PHP have?

What is PHP?

• PHP (PHP: Hypertext Preprocessor, short for Hypertext Preprocessor ), it is a widely used open-source scripting language based on servers used to generate dynamic WEB pages and embedded in HTML. It is especially suitable for WEB development.

• When a client sends a request to a program on the server, the web server submits the corresponding page based on the Response Request. When the page contains a php script, the server submits the request to the PHP interpreter for release, send the generated html code back to the client. The client's browser interprets the html code to form a webpage.

Execution Method

• PHP code is included in a special start character to enable webpage scripts to access "PHP mode ". For other scripts written in C or Perl, a large number of commands are required to write programs to output HTML, and an HTML Script is written in PHP, you only need to embed some code to complete the operation (for example, some text is output in this example ).

• Unlike the client-side Java, 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.

Install the PHP Runtime Environment

1. Install the PHP environment in Linux + Apache + MySQL + PHP and WAMP in Windows

Ii. Integrated Environment *: Wamp

PHP features

• It is an open-source scripting language on the server.

• Independent from the operating system, it can run in almost all systems.

• Supports most servers, such as Apache and IIS.

• Supports a large number of databases, mainly Access \ MySQL \ SQL Server.

• Images can be created.

•... ...
• There are also some other special features described in advanced technology later.

• We know that large websites such as Xunlei and Xinliang Weibo are using PHP programs.

C/S and B/S structure

The C/S (Client/Server) structure is a well-known Client-to-Server structure. It is a software system architecture. It can take full advantage of the advantages of both ends of the hardware environment, and rationally allocate tasks to the Client-side Server to achieve this, reducing the communication overhead of the system. At present, most application software systems are Client/Server two-layer Structures

B/S (Browser/Server) structure, that is, the Browser-to-Server structure. With the rise of Internet technology, it is a change or improved structure of the C/S structure. In this structure, the user's working interface is implemented through the WWW Browser. A few transaction logics are implemented on the Browser, but the main transaction logic is implemented on the Server. This greatly simplifies the Client Computer load, reduces the cost of system maintenance and upgrade, and reduces the overall cost of users.

Integrated Development Environment

WAMP

Apache + Mysql/MariaDB + Perl/PHP/Python in Windows, a group of open-source software commonly used to build dynamic websites or server are independent programs, however, because it is often used together, it has a higher degree of compatibility and forms a powerful Web application platform.

MAMP

In the Apple system, mamp pro is a professional version of OS x software in the classic local server environment. MAMP is the first letter on behalf of the Mac, Apache, and MySQL versions on Apple's OSX system. As the name suggests, you should know the powerful features of MAMP! MAMP contains the Apache server, PHP installation kit, and MySQL installation kit.

PHP markup style

<? Php... ... ?>

This is the tag style recommended for PHP. The server administrator cannot disable this flag.

Easy HTML Mixing

<?phpif ($expression) {?><strong>This is true.</strong><?php} else {?><strong>This is false.</strong><?php }?>

PHP will directly output any non-PHP code in the end mark as the next start mark. When a large amount of text needs to be output, exiting the PHP parsing mode will be more effective than printing all the text using functions such as echo () or print.

Semicolon

PHP separates simple statements with semicolons. Composite statements use braces to mark code blocks, such as conditional tests or loops. Do not use semicolons after braces. Different from other languages, right brackets (?>) in PHP) The semicolon is not required.

Blank line break

Generally, blank spaces do not matter in PHP. You can expand a statement into any row or compress the statement into one row. This flexible format can be used to make the code more readable (by arrangement and distribution, indentation, etc ). Some lazy programmers do not advocate using this free format to create code that cannot be read at all.

Program comments

PHP supports C, C ++ Shell script style annotations, as shown below:

• // Single line comment

•/*... */Multi-line comment (Note: Nesting is not allowed)

• # Script Annotation

Summary

The above is the basic PHP knowledge (super practical) that php Tom must know. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.