【php】day01

A .PHPCORE foundation
 1. What is PHP: [Hypertext Preprocessor]
            the WEB program development language, running on the server side
                         scripting language
 benefits 2.PHP of
   (1) open source code
   (2) support a variety of platforms (WindowS, Linux, etc.)
   ( 3) support a variety of WEB server (the apache, IIS Tomact, Nginx)
   (4) supports multiple databases (Mysql, SQLServer, Orcale etc.)
 3.PHP installation (Windows)
   (1) install apache server, WEB server can only resolve static pages
   (2) install PHP engine
      a.php-5.4.15-Win32-VC9-x86.zip
                free installation decompression, into the intended installation location renamed
      b. the php.ini-development instead php.ini
                file name as PHP configuration file
      . c apache bind the PHP engine and
                 the following code written in the conf / http.conf file:
        # load PHP5 this module, load path php5apache2_2.dll full name and location
Php5_module LoadModule "D: \ php5.4 \ php5apache2_2.dll"
# load the PHP configuration file is located
PHPIniDir "D: \ php5.4"
# tell Apache what types of files to the PHP engine processes
AddType application / x-httpd- .php PHP
    (3) PHP principle: If a browser requests a page .php, apache server
                 only static pages, apache server please help PHP engine, PHP
                 engine performs dynamic pages and static results after the execution to the apache
                 server, apache server can parse static pages, in response to the client
                 -side browser, the final result will be displayed
grammar structure 4.PHP of
  (1) XML style (basic style)
  <PHP?
     ...
  ?>
  Note: If the last is the PHP code '?>'
          terminator can be omitted, recommended omitted
  (2) short style
  <?
    ...
  ?>
  Note: you need to modify the configuration file the php.ini
     short_open_tag = Off
           to On restart apache server
  (3) asp-style
  <%
    ...
  %>
      Description: need to modify the configuration file the php.ini
       asp_tags = Off
               to On restart apache server 
  (4) script style
  <Script Language = "PHP">
  ...
  </ Script>
  
5.PHP document structure of
  (. 1) PHP Code
  (2) HTML tag
  (3) CSS pattern
  (4) Javascript, Jquery
    Description: PHP document structure, there may be a plurality of PHP syntax structure,
            and can be placed anywhere PHP as position, the
            end of each code in a semicolon
            
6.PHP Notes
  (1) # single line comment
  (2) // single line comment
  (3) / * multi-line
                comment * /
7 variable (Varible)
   1. What is variable: in the amount of memory in there name, and the amount the program
            can change the execution, that is the variable value temporary storage container.
           Memory: temporary storage of data and programs currently executing a power down
                      No data exists
   2. When a variable: when the data are used more than once, it can be
                                   defined as a variable
                                   
   3. declare variables
     $ variable name;
     $ variable name = value;
   4. naming variable name
     (1) $ start , then the variable name begins with the letters and underscore
                            the back contain numbers, letters, underscores.
                            
     (2) prohibit variable name contains special symbols, such as a space
                  slash, backslash are special symbols
     (3) possible variable names unambiguous
     (4) maximize the use of the variable name camelCased
                  example: the userName UserName
     (. 5) the variable name is case sensitive
                 For example: $ test $ Test is not a variable
     (6) the same as the variable name, the value of the latter overwrite the previous value.
    The use of special variables
      (1) several variables to the same value
      (2) variable variable
      (3) reference variables: &
      
A data type (data type and eight main pseudo type 4)
  << 8 primary data type
     (1) scalar types (single value stored)
         a. integer (Int Integer)
         B. float (the Float, Double)
         C. Boolean type (Boolean Bool)
         D. character type (String)
     (2) complex type (store multiple values)
         a. Array (the Array)
         b Object (Object).
     (3) a special type of
         a resource (resource).
         b NULL.

     (4) integer (integer Int)
        a PHP integer: decimal,
                                      binary (0b beginning),
                                      octal (leading 0),
                                      ten hexadecimal (0x at the beginning).
        . b maximum integer relationship with the operating system
          PHP_INT_MAX see maximum,
                     exceeds the maximum overflow occurs and becomes floating-point type
     (5) float (the Float, Double)
        A scientific notation (e or E).
                     For example: 2.1e2 = 2.1 * 10 ^ 2
               2-= 2.1 2.1e / (2 ^ 10)
        B. Maximum float relationship with the operating system has
                     a maximum E308 * 1.79
        c.PHP stored in the floating-point approximation, so do not
                    float compare
     
     (6) Boolean type (Boolean Bool)
        . only a tRUE | true true and fALSE | false false
                     two values 
                   
     (7) character type (String): must be enclosed by a delimiter up
        a delimiter.
           (a) single quotes (recommended) 
           (b) double quote
           (c) hereDOC (custom delimiter)
           (D) nowdoc (custom delimiter)
        B. difference between the single and double quotes
           (a) can resolve the variable double quotation marks, the single quotation marks are not resolved variables
           (b) can resolve all of the double-quote escape character, single quote only
                             parse \ 'and \\
        
        C. escape character (special symbol in the source code)
          \' single quote
          \ "double quote
          \ n newline
          \ r carriage return
          \ t horizontal tab
          \ v Vertical tab
          \\ backslash
          
        d. Using HTML entities and single and double quotes escape character
          (a) W3C predetermined special symbol seen in the browser must
             HTML entities, PHP, HTML must also be implemented with an entity
             
          (b) to see the source code with the escape character, in PHP
                           with the escape character when the single and double quotes conflict
======= ================================
 (. 1) echo: output string to the browser   
     of the echo string;
     echo string , string, string;
     echo (string); can output a string
     
 (2) Chinese garbled
   (1) xhmtl Chinese distortion:
       <Meta HTTP-equiv = "the Type-the Content" Content = "text / HTML; charset = UTF-. 8 "/>
   (2) the PHP in Chinese garbled:
      header ( 'the Content-the Type: text / HTML; charset = UTF-. 8');
             Description: front can not have any output
   (3) Chinese encoding editor:
      window-Preferences (parameters)
      -General (Basic). 8-UTF--Workspace
      
 (. 3) var_dump: print out the details (value, type)
 

     var_dump ($ var, $ var2, $ var3 ...);

 

 

Guess you like

Origin www.cnblogs.com/tommymarc/p/11627244.html