php [Basic theoretical knowledge]

Php theoretical knowledge

  1. What is
    PHP ? PHP is a powerful server-side scripting language for creating dynamic interactive sites.

  2. Php code tag

    <? php….?>, each sentence of PHP must end in English (;)
  3. Basic knowledge of Php web page
    Ip address: IP address is divided into two versions: v4 and v6. The length of v4 is 32-bit binary code, and v6 is 128-bit binary code. The v4 version of the IP has been used up around 2010. The main format is 192.168.4.238 (dotted decimal method), which is composed of four segments, each segment is 8-bit binary, and the value range expressed in decimal is: 0-255, special IP : 127.0.0.1 is used for software testing or website testing of this machine, and you can only access your own 127.
    Domain name resolver (DNS server): a database that stores a correspondence table between domain names and IP addresses
    Insert picture description here

  4. php basic syntax
    php variable: php variable must start with $, cannot start with a number

  5. PHP data types:
    string, integer, floating point, boolean, array, object, null

  6. PHP data type judgment:
    var_dump
    is _ * () returns a boolean (* represents the type)
    isset () detects whether the variable is set
    empty () detects whether the variable is empty


  7. Conversion of data types into bool values ​​(bool) c s turn change for whole ( i n t ) cs converted to integer value (int) CS
    is converted to floating point values (float) c s ( s t r i n g ) cs to string CS
    array into a string
    array to a string implode ( ",", $ array
    string transfer array explode ( "", $ pizza)

  8. Php operator
    Numeric operator: (+,- ,, /,%, ++, –)
    String operator: (. Similar to + splicing in js)
    Assignment operator: (=, + =,-=,
    = , / =,% =)
    Comparison operators: (>, <,> =, <=,,=,! =,! ==)
    logical operator: (&&, || ,!)
    ternary operation: a? B: c

  9. Php loop statement
    While (conditional judgment) {break}
    for (conditional judgment) {}
    break statement can add break 2 means to jump out of the two-layer loop
    continue statement jumps out of this loop, start the next loop directly
    in the tp and foreach ($ array as $ k => $ v) {} loop

  10. Session and cookie
    Session and cookie are super global variables.
    Storage location session is stored on the server, cookie is stored in the browser.
    Security Session security is higher than cookies

  11. Php commonly used mysqli function
    mysqli_query (): execute a query against the database.
    mysqli_num_rows () returns the number of rows in the result set
    mysqli_fetch_array () from the result set row as an associative array, or an array of numbers, or both
    mysqli_fetch_row () to obtain a line from the result set and returned as an enumerated array
    mysqli_close () previously closed Open the database connection
    mysqli_select_db () Select the database
    mysqli_connect (port, account, password) to connect to the database

  12. Php constant
    Set the constant: Use define () to set the constant
    Define function has three parameters.
    name: mandatory parameter, constant name, that is, identifier
    value: mandatory parameter, constant value
    case_insensitive: optional parameter, if set to TRUE, the constant is not case sensitive. The default is case-sensitive
    constants are global: after the constant is set, it can be used anywhere in the entire running script

  13. Php class
    What is a class: A class is a collection of variables and functions that act on these variables.
    How to define the class:
    Insert picture description here

  14. Private, protected, and public modifier access rights
    private: private, only the current class can call
    protected: protected, only the current class, or inherited classes can call
    public: public, any class can call

This is the end of the summary. There is still a lot of knowledge about php theory. What I have summarized is only a few. I need to know more about myself. I hope my article can help everyone. Thank you! ! !

Published 5 original articles · praised 13 · visits 235

Guess you like

Origin blog.csdn.net/DarKer_LB/article/details/105470272