PHP is a widely used, open-source, server-based scripting language for generating dynamic Web pages that can be embedded in HTML, especially for WEB development. The following for everyone to share PHP white must know the basic knowledge of PHP, super-practical, interested friends to learn together
Many people see PHP as a programmer, thinking that money is a lot (although the fact), but also to consider whether they are suitable for this line, know what PHP is? PHP has what kind of function, can be used to do?
What is PHP?
PHP (php:hypertext preprocessor, abbreviation for hypertext preprocessor) is a widely used, server-based scripting language for generating dynamic Web pages that can be embedded in HTML, especially for WEB development.
• When a client requests a program from the server, the Web server requests the corresponding page according to the request, when the page contains PHP script, the server will give the PHP interpreter to explain the execution, the generated HTML code back to the client, the client's browser to interpret the HTML code, The page that eventually forms the page format.
Execution mode
The PHP code is included in the special start typeface Terminator, allowing the Web page's script to enter and exit the PHP mode. Other scripts written in C or Perl require a large number of commands to write programs to output HTML, and PHP to write an HTML script that simply embeds some code to complete the operation (for example, some text is output in this example).
• Unlike the Java client, the PHP code is run 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.
PHP Run Environment installation
Install PHP environment under Linux linux+apache+mysql+php, install PHP environment under Windows Wamp
Second, integrated environment *:wamp
Features of PHP
• Is an open source, server-side scripting language.
• Operates independently of the operating system and can be run on almost any system.
• Support for most servers, such as Apache,iis.
• Support for a large number of databases, mainly Access\mysql\sql server, these two kinds.
• You can create an image.
•... ...
• There are a number of other features featured in the advanced technical details later in this article.
• We know that websites like thunder, Xinliang and other large websites are using PHP programs.
c/S and b/s structure
c/S (CLIENT/SERVER) structure, known as the client-server structure. It is a software system architecture, which can make full use of the advantages of both ends of the hardware environment, the task is reasonably distributed to the client Retransmitting server side to achieve, reduce the communication overhead of the system. At present, most application software systems are two-layer structure in client/server form.
b/S (BROWSER/SERVER) structure is the browser-server structure. It is a change or an improved structure of C/s structure with the rise of internet technology. In this structure, the user interface is implemented by the WWW browser, and very few transaction logic is implemented at the front end (Browser), but the primary transaction logic is implemented on the server side. This greatly simplifies the client computer load, reduces the system maintenance and upgrade costs of the workload, reducing the overall cost of users.
Integrated development Environment
WAMP
Windows Apache+mysql/mariadb+perl/php/python, a group of open-source software used to build dynamic Web sites or servers, are themselves separate programs, but because they are often used together, they have a higher degree of compatibility, Together make up a powerful Web application platform.
MAMP
The Apple system under Mamp Pro is a professional version of the classic local server environment of OS X software. Mamp these initials for Apple's OSX system on the Macintosh, Apache, MySQL PHP, as the name implies, you should know Mamp's powerful features! MAMP includes Apache server, PHP installation Kit, and MySQL installation kit.
PHP's markup style
<?php ...? >
This is the markup style recommended by PHP. Server Administrators cannot disable this style of tagging.
Easy to mix with HTML
<?phpif ($expression) {><strong>this is true.</strong><?php} else {? ><strong>this are false.</strong><?php}?>
PHP will directly output any non-PHP code in the next opening tag of the closing tag. When you need to output a large amount of text, exiting PHP parsing mode will be more effective than printing all the text using echo () or print () or a function of this class.
Semicolon
PHP uses semicolons to separate simple statements. Compound statements use curly braces to mark blocks of code, such as conditional tests or loops, and do not use semicolons after curly braces. Unlike other languages, a semicolon before the closing parenthesis (?>) in PHP is not required.
Blank line break
In general, whitespace characters do not matter in PHP. You can expand a statement to any row, or tighten the statement to a single line. You can use this flexible format to make your code more readable (by arranging allocations, indenting, and so on). It is not recommended that some lazy programmers use this free format to create code that cannot be read at all.
Notes for the program
PHP supports C, C + + shell script style annotations, as follows:
//Single-line comment
/* ... * * Multi-line Comments (note: cannot be nested)
# Script Comments
Summarize