PHP Getting Started - Know PHP

xiaoxiao2021-03-06  42

Incoming URL Variable: Example: My.php? Temp1 = Hello Word

Variable value reading: Output URL value: URL incoming value: Comparison with ASP, huh, huh. . Almost the same REQUEST ("TEMP1") about data type

PHP uses a mixed variable category and the troubles of the province declare. This point and VB are like huh. Easy TMD is convenient. Variable output

Method 1: Method 2: Method 1 and ASP are almost the same. . . The identification in the ASP is: <% = Temp%> About syntax

Almost in the same way as C / C . . OOP is also supported. Strong .. also supports PHPGTK. Fancy. (^^ Small said, PHPGTK did not test success.) Non-print characters

character

meaning

/ CX matches the control character indicated by x. For example, / cm matches a Control-M or an Enterprise. The value of x must be one of A-Z or A-Z. Otherwise, the C is treated as a primary 'c' character. / f Match a change page. Equivalent to / x0c and / cl. / n Match a newline. Equivalent to / x0a and / cj. / r Match a carriage return. Equivalent to / X0D and / cm. / s Match any blank character, including spaces, tabs, change page, and the like. Equivalent to [/ f / n / r / t / v]. / S Match any non-blank character. Equivalent to [^ / f / N / R / T / V]. / t matches a tab. Equivalent to / x09 and / ci. / v Match a vertical tab. Equivalent to / x0b and / ck. Conditions and cycles

for {}

Current INDEX: $ I
";}; INDEX: 0 Current INDEX: 1 Current INDEX: 2 Current INDEX: 3 Current INDEX: 4 forach

Function: Used to travel to array, quickly traversal. . . (Delphi is incorporated into the for Each command) after the .NET version. Instance code $ myArray = array ("myname" => "lijinjie", "year" => "23"); Foreach ($ MyArray AS $ TEMP) {Echo " $ TEMP
";} Execution: Lijinjie23 While {}

Example: $ I = 5; While executes index: $ I
";} Execute Index: 4 Execute INDEX: 3 Execution Index: 2 Execute Index: 1 Execute Index: 0 do while {}: do while and while the biggest difference is. . Do while is executed first, and then judge, and while is first judged. I don't understand, don't make an instance code. IF {} else {}: Earth people know, do not do instance code. Switch:

Switch ($ I)

{

Case (1): / * code here * /;

Case (2): / * code here * /;

Case (3): / * code here * /;

DEFAULT:

/ * Code Here * /

}

The Switch structure can be well resolved, and the code caused by multiple IF ELSE is too long. However, it is necessary to pay attention to excessive use of the Switch structure, which will increase the execution efficiency of the code. (^^ Delphi experience knows)

FUNCTION

The function is the most important part of the C language, and it is also its soul. The function definition in C and PHP is not as stringent in Delphi. C function

INT Checkbig (int X, y)

{

IF (x> y) {

Return (x);

} else {

Return (Y);

}

Function in PHP

Function Checkbig ($ x, $ y) {

IF ($ x> $ y) {

Return $ x;

} else {

Return $ Y;

}

}

Functions in Delphi:

Function Checkbig (X, Y: Integer): Integer; Begin

IF x> y death results: = x else result: = y;

END;

From the code of the three C / PHP / Delphi. . The code of PHP is relatively simple. Because of the support of hybrid, there is no need to declare variables, and the type of function. Everyone is also very easy to see. . The PHP code is like hybridized varieties of C and Pascal code. (^^ is an excellent drip hybrid variety). Like learning. A comparative learning method is a new development language that can be mastered very quickly. The above is the first hour of the first time I first contact PHP. Please leave everyone to do a reference, for the first time, it is inevitable in the middle, please forgive me. (^^ 2 o'clock in the morning. I only have time to study at this time, crying ing .. Finally, the PHP is installed on Win2003. Method and installation ActivePerl is the same. Run in CGI mode.

Download PHP-WIN32 5.x version http://www.php.net Unzip to C: / PHP to rename the php.ini-dist of the folder to php.ini and store it to C: / Windows (PHP.ini file I don't talk much here, I look at the install.txt file with the band, I have a very detailed note that you have 2 registry files in the head. . One is pws-php5cgi.reg another PWS-Isapi.Reg is imported into the registry Open IIS Manager: New Site. . . Of course if you have. . Don't build again. Click [Properties] -> Select [Main Directory] -> [Configuration] -> [Add] -> Record Document Order: C: /PHP/php-cgi.exe "% S"% s extension Name: .php huh. . The Perl is also set. . Both this look. .

after finishing. save. Ok, turn it off again. . . Built this test.php content is: <% echo phpinfo ();%> Open an IE, of course you can also use firefox. . Enter http://127.0.0.1/test.php This will output a configuration instructions on the php.ini file. And web environment descriptions. If it is a CGI error, what is wrong. . . ----> Trick ---> Restart the computer. . It can be solved. . If still can't, check if the above operation is correct.

DSFDSF

转载请注明原文地址:https://www.9cbs.com/read-55908.html

New Post(0)