This article mainly and everyone to share the basic knowledge of PHP carding detailed, hope to help everyone.
Double quote explanatory variable, single quote not explanatory variable
Double quotation marks in single quotes, where there are variables in single quotes, the variable interpretation
The variable name of double quotes must be followed by a special character that is not a number, a letter, an underscore, or a variable enclosed in {}, otherwise the part after the variable name is treated as a whole, causing a syntax error
Enables single quote characters to use single quotes as much as possible, with single quotation marks more efficient than double quotes
get and post submission methods
Get generates a TCP packet; Post generates two TCP packets;
For a Get mode request, the browser sends the HTTP header and data out, and the server responds 200 (return data)
For post, the browser first sends the header, the server responds to the continue, the browser sends the data, and the server responds with a $ OK (return data).
Get is harmless when a browser is rolled back, and post submits the request again
The GET request will be active by the browser cache, and post will not, unless manually set
The GET request parameters are kept intact in the browser history, and the parameters in the post are not preserved
Get requests can only be URL-encoded, while post supports multiple encoding methods
Get is less secure than post because parameters are directly exposed to URLs, so they cannot be used to pass sensitive information
How to get the real IP of the client
$_server[' REMOTE_ADDR ' or getenv (' REMOTE_ADDR ')
You can use Ip2long () to turn into numbers
include and require
Require is an unconditional inclusion, that is, if a process joins require, whether or not the condition will be executed first require, when the file does not exist or cannot be opened, will prompt the error, and will terminate the program execution
Include has a return value, and require does not (possibly because this require faster than include), if the contained file does not exist, then will prompt an error, but the program will continue to execute
Note: Require is fatal when the include file does not exist or is syntactically incorrect, and include is not
What are the advantages of Ajax?
Ajax is asynchronous transmission technology, can be implemented through JavaScript, or through the jquery framework, to achieve local refresh, reduce the pressure on the server, but also improve the user experience
How to improve the running efficiency of the program in the development of the program
Optimization SQL statement, query statement to try not to use the SELECT *, which field to check which fields;
Less use of sub-query available table connection instead;
less use fuzzy query;
Create an index in the data table;
Generate caches for data that is frequently used in programs;
The difference between a session and a cookie
Storage location: Session stored on server, cookie stored in browser
Security: Session security is higher than cookie
Reference Link: https://www.zhihu.com/questio ...
isset and empty
The Isset () function is commonly used to detect whether a variable is set
Returns FALSE if the variable does not exist
Returns FALSE if the variable exists and its value is null
Returns TURE if the variable exists and the value is not NULL
The empty () function checks if the variable is empty
Returns TRUE if the variable does not exist
If the variable exists and its value is "", 0, "0", NULL, FALSE, Array (), Var $var; and objects that do not have any properties, the TURE is returned.
If the variable exists and the value is not "", 0, "0", NULL, FALSE, Array (), Var $var; And an object that does not have any properties, it returns FALSE
Three Paradigms of database
The first paradigm: 1NF is an atomic constraint on attributes, requiring attributes to be atomic and non-decomposed.
The second paradigm: 2NF is a unique constraint on records, requiring records to have a unique identity, that is, the uniqueness of the entity;
The third paradigm: 3NF is a constraint on field redundancy, that is, any field cannot be derived from another field, it requires no redundancy in the field.
difference between primary key, foreign key, and index
Defined:
Primary Key-uniquely identifies a record, cannot be duplicated, is not allowed to be empty
Foreign key--the foreign key of the table is the primary key of another table, the foreign key can have duplicate, can be a null value
Index--The field does not have duplicate values, but can have a null value italic text
Role:
Primary key--to ensure data integrity
Foreign key--used to establish contact with other tables.
Index--is to improve the speed of query sorting
Number:
Primary key--the primary key can only have one
Foreign key--a table can have multiple foreign keys
Index--A table can have multiple unique indexes
The difference between heaps and stacks
Stacks are allocated memory space during compilation, so your code must have a clear definition of the size of the stack;
A heap is a dynamically allocated memory space during a program's run, and you can determine the size of the heap memory to allocate depending on how the program is running.
Related recommendations:
The basic question of PHP is collated
PHP Basic Function Example Detailed
PHP Basic Knowledge Note sharing