Home > Backend Development > PHP Tutorial > PHP core knowledge points, PHP core points_PHP tutorial

PHP core knowledge points, PHP core points_PHP tutorial

WBOY
Release: 2016-07-12 08:59:45
Original
925 people have browsed it

php core knowledge points, php core points

Php: scripting language, website construction, server-side operation

PHP definition: a server-side HTML scripting/programming language that is simple, object-oriented, interpreted, robust, safe, very high-performance, architecture-independent, and portable , dynamic scripting language. It is a multi-purpose scripting language widely used in Open Source that is particularly suitable for web development and can be embedded in HTML. Its syntax is close to C, Java, and Perl, and it's easy to learn. The language allows web developers to quickly write dynamically generated web pages.

Introduction to PHP: Rasmus Lerdorf development history (1994: 1.0 personal perl, 1996: 2.0C bottom layer, 1998: 3.0zendEngine, 2000: 4.0session output buffer, etc., 2004: 5.0zend engine 2nd generation), platform support (window, Linux, UNIX), database support (Sqlserver, mysql, Oracle, Access), development environment (Apache2, mysql, php)

Server: software, common services (HTTP, FTP, MySQL, telnet, etc.)

Software structure: cs, bs, PHP status

Web access: IP, domain name, hosts, domain name server, website, web access

Original data storage: php file, database file

Build a web server:

Wamp, lamp, Apache installation (www.apache.org)

MySQL installation

PHP installation (no Chinese path, CMD executes php.exe -f, VC6 and VC9), configuration (Apache loads PHP module: LoadModule php5_module "PHP5apachedll path"; add PHP processing: AddType application/x-httpd-php. php; load php configuration file: windows, Apache configuration file loads PHPIniDir "PHP configuration file path"; configure PHP time zone: date.timezone)

Php operates the database: PHP opens the MySQL extension and specifies the extension directory (extension_dir)

Web operating principle: static, dynamic

Virtual host configuration: Domain name-based virtual host, including vhost configuration, edit virtual vhost file (VirtualHost, ServerName, DocumentRoot), restart, modify hosts file, localhost reconfiguration

PHP script execution: read source program, zendEngine (lexical analysis, syntax analysis), generate opcode, execute opcode, interpretation, and the difference between compilation

PHP work: scripts (server-side scripts, web server and browser required), command line scripts

Basic syntax: script language (embedded in html), PHP processing (tag recognition), tag (, default, , <%asp tag%> are not default and need to be turned on; not recommended), the last tag can be ignored (it is recommended to ignore: Ajax return, save traffic), PHP statement (end with semicolon, the last one (can be omitted)

Variables: $ symbol, valid variable name (starting with a letter or underscore, case-sensitive), variable addition, deletion and modification (unset to disconnect), naming rules (camel case, underscore)

Constant: definition (define), direct use, characteristics (cannot be modified, case-sensitive, cannot be deleted, constant value can only be a scalar, named the same as a variable, no $), constant judgment (defined), output (constant ('constant name'))

PHP comments: line comments, block comments

Predefined variables: $_POST, $_GET, $_REQUEST, $_FILES, $_SESSION, $_COOKIE, $GLOBALS, $_SERVER, $_ENV

Predefined constants: __FILE__, __LINE__, __DIR__, __FUNCTION__, __METHOD__, PHP_OS, PHP_VERSION, PHP_INT_SIZE, PHP_INT_MAX

Variable variables

Pass by value: pass by value, pass by reference

Data type: PHP if type, eight major data types (integer, floating point, Boolean, character, array, object, resource, empty), three major categories (scalar, composite, special)

Integer type: decimal, octal (0), hexadecimal (0x), specified decimal output (printf, %d, %o, %x), integer value range (PHP_INT_SIZE, PHP_INT_MAX), word Section, bit, base conversion (convert ten to others, take the remainder and invert; convert other ten, exponentiate), integer overflow (floating point type), timestamp (Greenwich Mean Time, time, date)

Floating point type: retain decimal output (printf(‘%.2f’), float, double

Boolean type: true and false, TRUE, FALSE (non-0), Boolean value output uses var_dump, FALSE (FALSE, 0, 0.0, '', '0', empty array, null value)

String: single quote, double quote, difference (parse variable, escape, {}, string array), delimiter (initial mark and end mark on one line, end mark topcase, parse variable, escape, actual application xml)

Operators: arithmetic operators (, -, *, /, %), assignment operators (=, =, -=, *=, /=, %=, .=), comparison operators (> ,<,>=,<=,==,===,!=,!==), error suppressor (@), self-operation operator (,--), string operator (. ), ternary operator (?:), logical operator (&&and, ||or,!), bitwise operator (&, |, ^, ~, <<, >>)

The complement of the original code's complement: the complement of the positive original code is the same, except for the negative sign bit, which is the complement of 1

Flow control: sequential structure, branch structure (if, ifelse, ifelse[else], switch[case, break, default]), loop structure (for, while, dowhile, foreach, continue, break)

Template syntax: tag syntax, branch structure and loop structure

Function: main function (code reuse, modular programming), definition (function function name (parameter list)), call (function name (parameter list)), no order relationship between definition and call, formal parameters, actual parameters, Parameter passing (passing by value, passing by reference, default value), return value (return interrupts execution, single return value, multiple return values ​​[passing parameters by reference]), scope (global scope, local scope, scope is for variables , in-depth analysis [js and PHP], super global scope, $GLOBALS and global)

Anonymous function

Pseudotypes: mixed, number, callback, void,

Data type conversion: int, integer, bool, Boolean, float, string, array, object, automatic conversion (value conversion)

Data type judgment: is_bool, is_float, is_integer, is_object, is_array, is_string, is_resource, is_scalar, is_null, is_numeric, gettype, settype

Reference files: require, include, require_once, include_once, function (layout, including public files), file loading principle (loading non-execution, loading compiled files), the difference between require and include, file return (configuration File)

Termination script: return, exit, die

Loading file path: absolute path, relative path (./, ../, /), relative path problem of file loading

String related functions: strlen, substr, strtolower, strtoupper, strrev, strpos, strrpos, strchr, strrchr (get file suffix name), trim

Time related functions: time, date, strtotime, microtime

Mathematical related functions: abs, floor, ceil, round, rand, mt_rand

Array: concept, reason for using array (variable association), PHP array characteristics (no data type, array subscript can be a string [cannot use for loop traversal], variable length of array will not overflow), array definition ( array, []), array cannot be echoed directly, array length (count, traversal), foreach (principle: assignment pointer moves down)

Two-dimensional array: definition, syntax, two-dimensional array traversal, associated two-dimensional array, traversal

Each list: each (grammar), list (grammar, only index array elements can be obtained, and values ​​are assigned in order of index), each and list are combined to traverse the array, the difference between each and foreach (foreach principle, each principle)

Array related functions: key, current, next, prev, end, reset, array_keys, array_values, data structure simulation (array_shift, array_unshift, array_push, array_pop), string splitting (explode, implode), array_walk_recursive (callback function, Delivery by address)

Array operations: , array_merge

Array comparison: ==, ===

Other functions: range, array_rand, shuffle

SQL injection: principles, solutions (addslashes, stripslashes, magic_quotes_gpc before 5.3, get_magic_quotes_gpc), public functions (array_walk_recursive escape of $_POST)

Array algorithm: sorting (bubble, insertion, selection, quick sort), search (custom search, dichotomy)

Form value transfer: website purpose (data management: collection, sorting, storage, publishing), collection (form implementation), data transfer (url, form), value transfer method (get, post)

Data receiving: $_GET, $_POST, $_REQUEST, data processing, $_REQUEST is not trustworthy (override, request_order, variables_order)

Click behavior judgment: isset($_POST[‘submit’])/empty()

Automatically configure global variables: register_gloabals5.3

Check box usage: [], storage (character splicing), display check box information (checked), batch deletion

File upload: concepts, difficulties (browser side, server side), process (form post, enctype='multipart/form-data', PHP configuration file_uploads, configuration item description (file_uploades, upload_max_filesize, post_max_size, upload_tmp_dir)) , file upload process (select files locally, submit, send files to server temporary directory, escape temporary files)

PHP processing: $_FILES, $_FILES description, file movement (copy, move_uploaded_file), verify file type (MIME), file rename (unique, identifiable distinction)

Upload function package

File operations: reasons (save data that does not change frequently and with small amounts of data; configuration files, traffic statistics, static web page generation, file downloads...)

Directory operations: opendir, readdir, rewinddir, closedir, scandir

Customized implementation of scandir function

File judgment: file_exists, is_dir, is_file, mkdir, rmdir, getcwd, chdir, file upload is managed by monthly classification

Loop all files and subfolders in the output folder: static variables, function recursion (principle, recursion point, recursion exit)

File operations: read and write, PHP5 (file_get_contents, file_put_contents[FILE_APPEND, FILE_USE_INCLUDE_PATH], array file), PHP4 (fopen, Mode[r, r, w, w, a, a], fgetc, fgets, fread, fputs, fwrite, fclose, fseek)

File related functions: copy, unlink, rename, filemtime, filesize, fileperms

File download: html download (a href='use.zip', disadvantages: simple file format, exposing the full path of the file), PHP (header("Content-type: application/octet-stream"), header(" Content-Disposition: attachment; filename=filename" ), output file content)

Part 2

0 Your Mysql extension library, PHP operates mysql

The main extension libraries for PHP to operate mysql database: mysql (process-oriented), mysqli (process-oriented and object-oriented), pdo (object-oriented)

Configure the mysql extension library: php.ini loads the extension and configure the extension path extension_dir

PHP operation mysql: principle,

Connect to the database (mysql_connect[host,user,pass,new_link]),

Close the connection (mysql_close),

Select database (mysql_select_db),

Send sql (mysql_query, different types of sql have different return values),

Parse the result set resources (mysql_num_rows result set row number, mysql_fetch series to obtain the result set data, result set pointer, traverse the result set)

Other related functions: number of affected rows (mysql_affected_rows), ID of new data (mysql_insert_id), setting result set pointer (mysql_data_seek)

Successful registration jump function, paging function (one-time acquisition, acquisition by page)

HTTP protocol: Hypertext Transfer Protocol, the basic protocol followed by the b/s architecture project, the basic principle of browser-server communication (request connection (TCP/IP protocol), the connection is successful, the browser sends the request, and the server processes the request, The browser processes the result and closes the connection), two parts of the HTTP protocol (request, response), url, features (supports client/server mode, simple and fast [only request method and path], flexible [arbitrary data], no connection [each Only one request is processed per connection], stateless [no memory capacity for transaction processing])

HTTP request:

Four parts (request line, request header, blank line, request body)

Request line (request method, request file, protocol/version)

Request headers (host, accept-encoding, referer, connection, accept-language, cookie, user-agent, accept, content-length (post), if-modified-since (get), content-type (post) )

Blank line

Request body (post request data)

Telnet simulation request

HTTP response:

Four parts (status line, response header, blank line, response body),

Status line (protocol/version, status code, status description),

Response headers (server, date, last-modified, content-length, content-type, location, refresh, content-encoding, cache-control),

Blank line,

Response body (content), header cannot be output before, header sets cookie

Function that cannot be output before function call: session_start, setcookie, header, output_buffering

Common response status information:

1XX (the server receives the request and continues processing),

 2XX (success, 200),

3XX (redirect, 302 redirect, 304 no modification),

4XX (request error, 404 not found, 403 forbidden),

 5XX (server error, 502 invalid response)

PHP mock responses and requests:

Response (jump, refresh, send image, download (application/octet-stream, content-disposition: attachment; filename),

Requests (fsockopen, fwrite, feof, fgets, get request, post request)

Object-oriented: process-oriented (operation process) and object-oriented (operation subject), oop (a software design architecture idea)

Basic concepts: class (abstraction of object), object (instantiation of class/class type (custom data type)), instantiation, members (variables, functions, constants in the class)

Grammar operations:

Define class,

Instantiation (new, with brackets, without brackets),

Casting (object), stdClass (empty class),

Access modification qualifier (var, public, protected, private, difference),

Object access member (->),

There are only three members in the class (properties, methods and constants, cannot be echoed),

The value defined by the attribute must be a fixed value. How to access private attributes (method, $this)

Memory description: classes, objects, methods, attributes (divided from space usage, non-memory division)

Magic methods: constructor (initialization), destructor (release resources, unset objects), constructor privatization

Constructor method compatible: class name method

Case sensitivity: properties, array subscripts and variables

Object passing: passing by reference

Object comparison: == (similar objects with the same attribute values), === (same object)

DB class: Class file naming (class name.class.php)

Auto loading: There must be a class definition before instantiating an object, automatic loading (__autoload), automatic loading principle, automatic loading conflict (spl_autoload_register)

Class constants: definition (const), memory division, access (class access, range resolution operator, object access (method)), self keyword, difference between self and this

Static members: definition (static), properties, methods, access (scope resolution operator), the difference between access to static properties and constants

The difference between static methods and non-static methods ($this)

Magic methods: __toString() (echo object), __clone() (copy into different objects, cloning does not use the construction method, and prevents cloning (private))

Single case pattern: concept (a class has only one object), reason (saving resources), principle (three private and one public)

Factory pattern: concept (generating objects), reasons (convenient management), factory singleton pattern

Object-oriented does not necessarily have classes (js)

Three major features of Oop: encapsulation, inheritance, polymorphism

Encapsulation: data and data operations, the process of making classes, hiding the properties and implementation details of objects (privatization), and providing external use interfaces (restricting reading and writing)

Inheritance: One object directly uses the properties and methods of another object to reduce code duplication

Polymorphism: multiple different implementations of interfaces, not available in PHP

Inheritance: syntax (extends), inheritance principle, inherited member control (protected), inherited access (subclass accesses parent class, parent class accesses subclass)

Inheritance conflict: overriding, control level (subclass is weaker than parent class), access to parent class method with the same name (parent)

PHP single inheritance, chain inheritance (multiple inheritance), use of inheritance (table class inherits DB class)

Special classes: classes that cannot be inherited and classes that can only be inherited, final classes, final methods (can be inherited but cannot be overridden), abstract classes (cannot be instantiated), abstract methods

Project design: big project, many teams (interface specifications, abstract class specifications), small project (not used)

Interface: specifically stipulates the structure of the class, syntax (interface), interface body (constants and methods, methods cannot be implemented, only public), implementation interfaces (implements), subclasses must implement all methods of the interface, and implement multiple interfaces

Interview question: Does PHP support multiple inheritance? How to simulate? Is an interface a class? Is the interface an abstract class?

PHP overloading: processing when the user operates non-existent or unavailable member attributes or methods

Attribute overloading: __get(), __set(), __isset() (called when isset and empty), __unset() (called by unset)

Method overloading: __call(), __callStatic()

Meaning of overloading: limit the conditions for user operations and correct errors

Object saving and restoration: file_put_contents saves, file_get_contents obtains, objects cannot be saved directly

Serialize: serialize

Deserialization: unserialize, PHP_Incomplete_Class, the reason why the original object cannot be obtained (resource release), introduce the class file to get the original object, automatically load the class, and the database connection fails

Object saving and restoration: __wakeup(), __sleep()

Object judgment: instanceof, the inherited object belongs to both the subclass and the parent class

Object involves methods: class_exists, interface_exists, method_exists, get_class (get the object class name), get_parent_class (get the parent class name)

Object traversal: attribute traversal, regular foreach traversal, intra-class foreach traversal ($this), intra-class specific attribute traversal (iterator predefined interface)

[PDO]: PDO, function (convenient for transplantation), principle, configuration (extension)

PDO main classes: PDO (database connection, sql transmission), PDOStatement (result set, preprocessing), PDOException (PDO exception handling)

PDO class: constructor (dsn data source, username, password), object destruction (not provided, unset, null), executing SQL (no result set exec (add, delete, modify), lastInsertId; with result set PDOStatement query) , error handling (errorCode, errorInfo)

PDOStatement class: related functions (rowCount, columnCount), traversing the result set (fetch[FETCH_ASSOC, FETCH_NUM, FETCH_BOTH, FETCH_OBJ, FETCH_BOUND], bindColumn, fetchAll, fetchColumn, fetchObject, setFetchMode), preprocessing (prepare, execute[array parameter], bindParam [recommended, bind first and then assign], bindValue [not recommended, assign first and then bind, bind every time]), transaction processing (beginTransaction, commit, rollBack)

PDO attribute settings: setAttribute, getAttribute, attribute name and value (PDO::ATTR_AUTOCOMMIT (1,0), PDO::ATTR_CASE (PDO::CASE_LOWER, PDO::CASE_UPPER, PDO::CASE_NATURAL), PDO:: ATTR_ERRMODE (PDO::ERRMODE_SILENT, PDO::ERRMODE_WARNING, PDO::ERRMODE_EXCEPTION), PDO::ATTR_PERSISTENT (TRUE, FALSE))

PDOException class: try-catch-throw

Reflection: reflection reflection mechanism, reflection (ReflectionClass::export(class)), reflection class internal (new ReflectionClass(class), getConstants, getProperties, isStatic, getMethods)

Ecshop installation: virtual host, gd library extension, configure database, configure backend administrator, install test data, access the backend

Shopping system: imitate ecshop to create a small product management and shopping system

Function: Backend user login (form, session, cookie, verification code), product classification management (Infinitus classification), product management (file processing, thumbnails, watermark processing, paging, product batch management, WYSIWYG Editor use), time allowed (front product browsing, shopping cart actions, user management, etc.)

Design project: Design the project from the perspective of the project manager (project architecture (framework, source code, development model), code structure (project directory division, function division)

Current popular development models: secondary development, framework development

Data architecture: data size, update frequency; two major database camps (SQL, NOSQL), primary architecture (table, table function, table structure, data relationship within the table)

Front-end and back-end: front-end (viewed by users, display data), back-end (viewed by administrators, manage data), the front-end and back-end are divided by function, and artists and programmers are divided by work content

Project directory structure, code division: the project is divided into frontend and backend, admin is the backend directory; the frontend and backend public parts are under the frontend includes, and the backend public file admin/includes, both front and backend have default access entrance index.php

Project code design: data is the core, code is to access and manage data; data is stored in mysql, PHP accesses the database through db.class.php (under includes); logic and display are separated; public functions are encapsulated with classes (file Upload, image processing, paging)

Backend user login function design: login form (login, verification code, exit, retrieve password, remember password), admin/templates/login.php, code from simple to complex; one type of transaction requests a PHP file ( Login: admin/privilege.php)

Backend project initialization: running environment (error level, error display), basic directory constants, configuration file system, public code (automatic loading functions, jumps, etc.), admin/includes/init.php

Admin/includes/init.php: encoding settings (header), directory constants (__DIR__, backslash processing, ROOT_DIR, ADMIN_DIR, INCLUDE_DIR, ADMIN_INCLUDE_DIR, ADMIN_TEMPLATE_DIR), 5.3 low version directory constants (__FILE__)

Configuration file system: /config/config.php, database connection information, two-dimensional array (easy to distinguish)

Load configuration file: admin/includes/init.php, configuration file directory constant, configuration file globalization ($GLOBALS[‘config’])

Running environment settings: ini_set() (error_reporting, display_errors), error level relationship

Login interface: get it from ecshop, js file, image file, css file

Login function: privilege.php implementation, introduction of initialization file, introduction of login.php file, action (distinguishing action), if branch judgment action

User login form design: request privilege.php, design hidden field act, $_REQUEST (GPC, request_order, variables_order)

Verify user information: design administrator table (library, table, field (id, username, password, registration time, last login time and IP)), insert a piece of data, receive user submission data for verification, database operations (Use DB class, one class for each table (/includes/adminTable.class.php))

Table class design: inherit db class, attributes (table_name, fields)

Verify that the table class is called: automatically loaded (/includes/function.php), the initialization file introduces the public function library, instantiates the table object (pass in the database connection information, connect to the database), modify the instantiation method (automatic in the db class Call the configuration file), use the user name and password to verify the user (get the user information correctly, return FALSE on error), modify the user password (md5 encryption)

Analysis of working principle: user requests and gets verification results

Verification result processing: interface jump (header in PHP, document.location.href in js, refresh in HTML), create jump template /admin/templates/redirect.php, jump function admin_redirect in /includes/function .php, calling the jump function in privilege

Verify whether the user is logged in: define variable judgment, get parameters, session data

Enable session mechanism: off by default (session.auto_start in php.ini), session_start is on, $_SESSION (access session data), session realizes user login judgment

Session principle: session_start() opens the session and reads the session file content to $_SESSION. At the end of the script, the $_SESSION content is written to the session file, and then the $_SESSION variable is released

Session cycle: The browser closes the session and becomes invalid, and the browser and server session process

Cookie session technology: The server saves data in the browser, cookie principle, the difference between session and cookie

Cookie usage: setting cookies, obtaining cookies ($_COOKIE and $_REQUEST), modifying $_COOKIE (invalid for re-visits), cookie variable validity period, session invalidation principle, clearing cookies (setcookie), cookie directory distinction, cookie cross-domain, Cookie saves array in disguise

Session file: storage (session.save_path in php.ini)

Cookie file: The storage directory specified by the browser, the difference between IE and FF, view the cookie file in FF

Session login determination: The session records user information when the user logs in, determines the session information in index.php, and opens the session in the initialization file

Simulate session to achieve cross-scripting

Frame layout background: use ecshop background layout, index.php

Index.php implementation: The same processing method as privilege.php, using the ecshop template

Log out: clear session, jump to privilege.php login page, top.php (target attribute)

User information display: $_SESSION, the user’s last login time (modify the last login time after logging in)

Session in-depth: $_SESSION can only be an associative array, session can save objects, session expiration is affected by cookies, session file destruction (session_destroy, $_SESSION, setcookie), session layering (session.save_path, manually create folders)

After disabling cookies, the session is used (other methods allow the browser to carry sessionID). The a tag automatically carries the sessionID (session.use_trans_id, session.use_only_cookie), and is passed by PHP script (manually added, session_id(), session_name())

Verification code: Verification code meaning (anti-malicious requests), principle (Completely Automated Public Turing Test to Tell Computers and Humans Apart (fully automated Turing test to distinguish computers and humans), put the verification code content on the picture) , verification code process (generate, save to session, add to picture, user input, verification), compare ecshop verification code

GD library: Image processing extension, GD image processing process (create image resources (existing or new), operate images (crop images, modify images, fill images, thumbnails, write verification codes), save or output, release Resources)

Create verification code: get the verification code content, write the verification code to the session, write the verification code to the picture, and display the verification code picture to the form

Encapsulated verification code class: complicated verification code method (random background color, random text color, adding pixels, adding interference lines)

Project application verification code: request the action to obtain the verification code image, use the verification code when verifying the user's login, add a new verification code method (within the verification code class), click the verification code image to change the verification code (js)

Save user login information: cookie stores record identification (user ID), determines whether the user is logged in (determines session, determines cookie), adds a method to obtain user information through user ID, dangerous

Creating product categories: data table design (primary key, category name, sorting, parent ID), inserting data, category.php, product classification list interface, modifying the connection (menu), product classification class, method of calling product classification, Template displays classified data

Infinitus Classification: Principle (find top-level category, find sub-category), non-recursive implementation (specify parent category), recursion (recursion point, recursion exit), recursion principle, indentation (level identification), sort according to sorting field

Full name of constructed table: table name, db class table prefix, add table name structure to db class, use

in table class

Assign values ​​to field attributes: Add a method to get the table structure (get all keys, primary keys)

Category file access verification: Put login verification in init.php, introduce init.php file verification, and separate requests that need verification (login related does not require verification, $_SERVER['SCRIPT_NAME'], basename(), dir_name( ))

Classification operation: add classification (add form, submit form, process form data, classify into database), classify to specify superior classification, receive data in array and submit data, delete classification (prompt user (js), judge whether classification can be Delete (whether the last level), delete category)

Edit classification function: process (user clicks the menu to enter editing, displays classification data, user edits operations, submits forms, and processes edit data)

Re-encapsulate the method of obtaining data through ID (repeat, put in db class), add hidden category ID to the form

Product classification completed: no product quantity, classification list cache (judgment cache, update cache), Infinitus classification zoom

Product management: data table design (modeled after ecshop), data insertion, goods.php, improving product list (menu connection, action processing, data object operation, list template, icon)

Paging: process (determine the number of data display, determine the number of pages, limit), paging jump (home page, previous page, next page, last page, digital page, drop-down page)

Project paging: modify the configuration file (number of data displayed on each page), modify the list function (page number, display number parameters per page), modify the list function (obtain the total number of records, data, two-dimensional array), modify the call list Function

Paging class: separate paging does not include data processing (parameters), HTML (tags, IDs)

Delete product: processing method (recycle bin), add deletion flag (modify data table), deletion process (confirm (js), modify deletion flag, modify list function, update list)

Recycle bin operation: paging display (configuration file, paging class use), recovery

New products: process (connection, action, table method, template, tab function)

Duplication of insertion function: Add new insertion method (db class, verify array information, array assembly SQL, return insertion result), call the insertion function

File upload: post, enctype (mutipart/form-data), $_FILES (specially receives file data, field description, error description (0 no problem, 1 exceeds the size, 2 exceeds the size, 3 is partially uploaded, 4 is not uploaded , 6 no temporary folder, 7 error in writing files to temporary folder)), file upload principle (PHP server), moving temporary files (move_uploaded_file), file verification (size, type, rename, strrchar)

Image upload class: configuration file (upload size, upload type (string), upload path), upload naming rules (no duplication, keep the original suffix, easy to identify (prefix)), file upload process (error judgment, file Size judgment, file type judgment, rename, whether the upload is successful, return the new file name), if the file processing fails, the product is still uploaded (error prompt)

Review of product insertion process: collect form data, set initial value (number of clicks), upload file for judgment, make thumbnail judgment, call model, insert data

Making thumbnails: process (obtaining image resources (original image, target image), processing (adopting, copying), saving or outputting, releasing resources), sampling (determination of rectangular area)

Encapsulated thumbnail production: data acquisition (original image size, target image size, function type usage), thumbnail ratio (aspect ratio), thumbnail production process refinement (calculate original image width and height and thumbnail maximum size , determine the thumbnail size, create image resources (original image, thumbnail), sample copy, save output, destroy resources)

Thumbnail filler: Fixed thumbnail size (fill in insufficient areas, create thumbnail background) Advantages and Disadvantages (convenient for design display, inconsistent with the original image)

Watermark production: logo on pictures, two types (text, picture), basic process (original picture, watermark picture, merge)

Project watermark: configuration file, detailed process (obtain original image resources, determine watermark image resources, obtain watermark image resources, obtain image width and height, determine watermark position, calculate watermark position, determine merge results, save, return watermark image name ), change the name of the uploaded image to watermark

MVC: Software design paradigm (Model, View, Controller), separation of input processing and output, MVC framework (functional division M, V, C), PHP code development (mixing, display and logic separation) , data logic and business logic are separated), action (C handles one type of transaction, C contains multiple Actions), distinction (module module, model model, template template)

Automatic security update method: piece together sql statement, update, process (clean invalid fields, piece together sql statement (update part, conditions), forcefully set conditions (judgment conditions, automatic analysis conditions), return execution results)

Automatic deletion: delete based on ID (single =, array in), process (add quotes to parameters, piece together deletion conditions, return deletion results)

Session storage: session storage into memory, session storage (modify session storage mechanism), session storage principle, modify session system (session read and write function), modify process (prepare read and write methods, inform session system (session_set_save_handler() ))

Session table design: fields (sessionID, data, expiration time)

Session method is perfect: read (database query based on sessionID), write (write or update data based on sessionID, session data), open (extract public connection database code), database connection resource scope, destroy (delete data based on sessionID) ), recycling (cleaning expired sessions and expire fields according to configuration), session configuration (gc_maxlifetime, gc_probobility, gc_divisor)

Encapsulate session class: constructor (set session processor, pass parameters in array, open session, open parent class constructor), improve each method

Session method execution order (reading before recycling), modify the reading method (do not read expired data, read to determine expire), session destruction (stop executing the write method)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1096609.htmlTechArticlephp core knowledge points, php core points Php: scripting language, website construction, server-side running PHP definition: a Server-side HTML scripting/programming language is a simple, object-oriented...
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template