Note: 1. The Web page file is placed under the WWW file in Wamp; 2.the www file cannot appear in Chinese; web browsing method:1. No site established: location of the localhost/ file 2. Build Site: (1) Site-New Site-Open dialog box
1 (2) modify the name of the site in the dialog box (you can change it) and the local site folder (the location where www is saved in wamp)
2 (3) Select server Option: Click the + sign button, pop up the dialog box, change the link mode to "Local/Network", select the server file (www in wamp), the Web URL is: localhost
(4) tick the test box and click Save. PHP Tags:<?php content?> Embedded location is arbitrary, which location is can <??> the concatenation in PHP is used: Dot. "not a plus; you can parse a variable like this: {variable} 3. Define variables:$a=10; (general assignment when defined)4. Cast Type:
1 $a= (string)$a; // 1. Cast Class A property to String 2 Settype ($a, "string"); // 2. Cast Class A property to String
5. (1 $s = "Hello" $s 1 = ' Hello ' ; $s 2 =<<<a content // can also put div things A; // A; there must be nothing in front, including spaces.
1 double and single quote differences: 2 1. double quotation marks can be resolved escape, single quote non-resolvable escape 3 2. you can parse variables in double quotes, single quotes cannot parse variables 4 5 (2) special defined variable: variable variable 67$a= "Hello"; 8 $hello= "Zhang San"; 9 Echo $$a; // the output is Zhang San
16. (1) Output Syntax:21.Echo(Common)3 4 Echo $a, "Hello";//output multiple strings at the same time5 62.Print7 8 Print $a;//only one string can be output9 Ten(2) Special Output (method): One A Print_r();//that specifically prints an array of - - Var_dump($b); the Var_dump($b);//All information of the output variable, used in the error
17.function of the variable2 3 $a=10;4 Var_dump(Empty($a));//empty (); Determine if the variable is empty5 Var_dump(isset($a));//isset (); Determine if a variable is defined6 unset($a);unset();//Delete a variable7 8&represents the address of a variable9 $a=10;Ten $b=&$a; One Echo $b;//The output is the result of ten A - $a=10; - $b=&$a; the $b=5; - Echo $a;//the output is 5 .
18.operator Expressions2(1) Math operator + 、-、 *,/,%, + + 、--,3 4 $a++//first tune A, plus 1<br>++ $a//plus 1, then execute5 6(2) The mathematical operator + = (the current variable plus the corresponding value),-= (the current variable minus the corresponding value),. =(stitching)7 8 $a=10;9 $a+=3;//$a =10+3Ten $a-=3;//$a =10-3 One $a. = "Hello";//$a =10hello A -(3) Comparison operators <, >, = = Judgment equal,! =Not Equal - the $a=10; - $b=8; - Var_dump($a>$b); - +(4) Logical Operators -With && and//bool type data is performed with an operation with one false, and the result is false +or | | Or//bool type data is either performed or operated with a true result, which is true ANon -!//equivalent to reverse, true change false, false change True at(5) Three mesh operator - - $a=10; - $b=8; - Echo $a==$b?" Equal ":" Not Equal " - in(6) Error suppressor - error messages are divided into 3 categories to Notice: Tips + Warning: Warning - error: Really wrong the @ ERROR SUPPRESSOR: The output statement is written in front of the output, and the normal statement is written at the beginning *For example:Echo@$a;
1 The statement is similar to the statement in JS:2 39.Branch Statements4 if5 if..Else6 if..Else if..7 If nesting8 Switch.. Case9 Ten10.Looping Statements One for A while - -11.Array the foreach(Array asvariable) - foreach($attr as $v) - { - +}
PHP Foundation Creation