Key points of PHP core learning

Source: Internet
Author: User
Tags array definition bitwise operators form post php definition php introduction scalar set cookie domain name server
PHP Core Knowledge points

PHP: scripting language, website building, server-side running

PHP Definition: A server-side HTML scripting/programming language, is a simple, object-oriented, interpreted, robust, secure, high performance, architecture-independent, portable, dynamic scripting language. is a versatile scripting language that is widely used in open source, especially for Web development and that can embed HTML. Its syntax is close to C,java and Perl, and is easy to learn. The language allows Web developers to quickly write dynamically generated Web pages.

PHP Introduction: Rasmus Lerdorf Development History (1994:1 people perl,1996:2.0c Bottom, 1998:3.0zendengine,2000:4.0session+ output buffer, 2004:5.0zend engine 2 generation), Platform Support (WINDOW,LINUX,UNIX), database Support (sqlserver,mysql,oracle,access), development environment (apache2,mysql,php)

Servers: Software, common services (http,ftp,mysql,telnet, etc.)

Software structure: c\s,b\s,php status

Web Access: IP, domain name, hosts, domain name server, Web site, Web Access

Original data Save: PHP file, database file

To build a Web server:

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

MySQL Installation

PHP installation (no Chinese path, cmd execution php.exe-f,vc6 and VC9), configuration (Apache load PHP module: LoadModule php5_module "Php5apachedll path"; add PHP Processing: AddType application/x-httpd-php. php; Load php config file: windows,apache config file load phpinidir "php config file path"; Configure PHP Time zone: Date.timezone)

PHP Operation database: PHP open MySQL extension, specify extension directory (EXTENSION_DIR)

Web operating principle: static, dynamic

Virtual Host configuration: Based on domain name virtual host, including Vhost configuration, edit virtual Vhost file (virtualhost,servername,documentroot), reboot, modify Hosts file, localhost re-match

PHP script execution: Read into the source program, Zendengine (lexical analysis, parsing), generate opcode, perform opcode, explain, and compile the difference

PHP Work: Scripts (server-side scripts, Web servers and browsers required), command-line scripting

Basic syntax: scripting language (embedded HTML), PHP processing (tag recognition), tags ( , default, <%asp tags%> non-default, need to be turned on; not recommended), at the end of the tag can be ignored (recommended ignore: Ajax return, save traffic), PHP statement (semicolon end, the last bar can not add)

Variables: $ symbol, valid variable name (letter or underscore start, case sensitive), variable additions and deletions (unset disconnect), naming rules (Hump method, underline)

Constants: Definitions (define), direct use, features (cannot be modified, case-sensitive, cannot be deleted, constant value can only be scalar, named with variable, no $), constant judgment (defined), Output (constant (' constant name '))

PHP Comments: Line comments, block annotations

Predefined variables: $_post,$_get,$_request,$_files,$_session,$_cookie, $GLOBALS, $_server,$_env

Pre-defined constants: __file__,__line__,__dir__,__function__,__method__,php_os,php_version,php_int_size,php_int_max

Variable variable

Pass value: Value pass, reference pass

Data type: PHP if type, eight data types (integer, float, Boolean, character, array, object, resource, empty), three categories (scalar, compound, special)

Integer: Decimal, octal (0), Hex (0x), specified input output (printf,%d,%o,%x), integer value range (Php_int_size,php_int_max), byte, bit, binary conversion (10 RPM Other, except take back; other turn 10, exponentiation), Integer overflow (float type), timestamp (GMT, Time,date)

Floating-point type: Retains fractional output (printf ('%.2f '), float,double

Boolean: True and False, True,false (not 0), Boolean output using Var_dump,false (false,0,0.0, "', ' 0 ', empty array, null value)

String: Single quote, double quotation mark, difference (parse variable, escape, {}, string array), delimiter (initial and end exclusive line, end tag shelf, parse variable, escape, actual application XML)

Operators: Arithmetic operators (+,-,*,/,%), assignment operators (=,+=,-=,*=,/=,%=,.=), Comparison operators (>,<,>=,<=,==,===,!=,!==), error suppressors (@), self-operation operators (+ +, --), the string operator (.), the trinocular operator (? :), logical operator (&&and,| | or,! ), bitwise operators (&,|,^,~,<<,>>)

The original code anti-code complement: Positive source code, the same as the reverse code, minus sign the negation, +1 complement

Process Control: Sequential structure, branching structure (If,ifelse,ifelse[else],switch[case,break,default]), cyclic structure (for,while,dowhile,foreach,continue, Break

Template syntax: Tag syntax, branching structure, and looping structure

Functions: Main functions (Code reuse, modular programming), definition (function function name (parameter list)), Call (function name (parameter list)), definition and invocation without order relation, formal parameter, argument, parameter Pass (value Pass, reference pass value, default value), return value (returns interrupt execution, Single return value, multiple return value [reference pass parameter], scope (global scope, local scope, scope for variable, in-depth analysis [JS and PHP], hyper global scope, $GLOBALS and global)

anonymous functions

Pseudo type: Mixed,number,callback,void,

Data type conversions: 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 file: require,include,require_once,include_once, function (layout, contains common file), file load principle (load non-execute, load compiled file), require and include, File return (config file)

Terminate script: Return,exit,die

Load file path: Absolute path, relative path (./,.. /,/), file loading relative path problem

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

Time-dependent functions: Time,date,strtotime,microtime

Math-related functions: Abs,floor,ceil,round,rand,mt_rand

Array: concept, using array reason (variable association), PHP array feature (no data type, array subscript can be string [cannot use for loop traversal], array length variable does not overflow), array definition (array,[]), array cannot directly echo, array length (count, Traverse), foreach (Principle: assignment + pointer Move Down)

Two-dimensional arrays: definitions, syntax, two-dimensional array traversal, associative two-dimensional arrays, traversal

Each+list:each (Syntax), list (syntax, can only get indexed array elements, assign values in index order), each and list are combined to iterate through the array, each with a foreach difference (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 segmentation (Explode,implode), array_walk_recursive (callback function, pass-by)

Array operations: +,array_merge

Array comparison: ==,===

Other functions: Range,array_rand,shuffle

SQL injection: Principle, Solution (addslashes,stripslashes,magic_quotes_gpc5.3, GET_MAGIC_QUOTES_GPC), Public function (Array_walk_recursive to $_ Post Escape)

Array algorithms: Sorting (bubbling, inserting, selecting, fast), finding (custom lookup, dichotomy)

Table only son values: Website purpose (Data management: collection, collation, storage, release), collection (form implementation), data transfer (Url,form), Value-transfer method (Get,post)

Data reception: $_get,$_post,$_request, data processing, $_request not trustworthy (overwrite, request_order,variables_order)

Click Behavior Judgment: Isset ($_post[' submit '))/empty ()

Automatically configure global variables: register_gloabals5.3

check box using: [], warehousing (character stitching), display check box information (checked), bulk delete

File Upload: concept, difficulty (browser side, server side), Flow (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 (local Select file, commit, send file to server temp directory, escape temporary file)

PHP Processing: $_files,$_files description, File Move (copy,move_uploaded_file), verify file Type (MIME), File rename (uniqueness, recognizable distinction)

Upload function Encapsulation

File operations: Reason (save infrequently changing data volume small data; profile, traffic statistics, static Web page generation, File download ...) )

Directory Operations: Opendir,readdir,rewinddir,closedir,scandir

Custom implementation Scandir function function

File judgment: File_exists,is_dir,is_file,mkdir,rmdir,getcwd,chdir, File upload by month classification management

Loop output folder All files and subfolders: Static variables, function recursion (principle, recursive point, recursive 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 correlation functions: Copy,unlink,rename,filemtime,filesize,fileperms

File Download: HTML download (a href= ' Use.zip ', Cons: Simple file format, exposed file full path), PHP (header ("Content-type:application/octet-stream"), Header (" Content-disposition:attachment; Filename=filename "), output file contents)

Part II

0 MySQL Extension library, PHP operation MySQL

PHP operation MySQL Database main extension library: MySQL (process oriented), MYSQLI (Process and object oriented), PDO (object oriented)

Configure MySQL Extension library: php.ini load extension, configure extension path Extension_dir

PHP operation MySQL: principle,

Connection 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 return values are different),

Parse result set resource (mysql_num_rows result set row number, Mysql_fetch series get result set data, result set pointer, traverse result set)

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

Registration successful jump function, paging function (one-time access, by page)

HTTP protocol: Hypertext Transfer Protocol, B/S Architecture project follows basic protocol, browser server communication Fundamentals (Request connection (TCP/IP protocol), connection success, browser send request, server processing request, browser processing result, close connection), HTTP protocol two parts (request, response) , URL, features (support client/server mode, simple fast [just request method and path], flexible [arbitrary data], no connection [only one request per connection], stateless [Transaction not memory capability])

HTTP request:

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

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

Request Header (Host,accept-encoding,referer,connection,accept-language,cookie,user-agent,accept,content-length (POST), If-modified-since (Get), Content-type (POST))

Blank Line

Request Principal (POST request data)

Telnet Impersonation Request

HTTP response:

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

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

Response Header (Server,date,last-modified,content-length,content-type,location,refresh,content-encodeing,cache-control),

Blank Line,

Response Body (content), header cannot output, header set cookie

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

Common response status information:

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

2XX (Success, 200),

3XX (redirect, 302 Redirect, 304 not modified),

4XX (request error, 404 Not Found, 403 forbidden),

5XX (server error, 502 invalid response)

PHP Mock responses and requests:

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

Request (Fsockopen,fwrite,feof,fgets,get request, POST request)

Object-oriented: process-oriented (operational flow) and object-oriented (operator body), OOP (a Software Design architecture idea)

Basic concepts: Class (Object abstraction), Object (Instantiation/class type (custom data type)), instantiation, member (variable, function, constant in class)

Syntax manipulation:

Define classes (Class),

Instantiation (new, with parentheses, without parentheses),

Cast (object), StdClass (empty Class),

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

Object access member (-),

There are only three members in a class (properties, methods and constants, cannot echo),

The value of the property definition must be a fixed value, how to access the private property (method, $this)

Memory Description: Classes, objects, methods, properties (partitioning from space use, non-memory partitioning)

Magic Method: Construction Method (initialization), destructor method (freeing resource, unset object), structuring method privatization

Construction method Compatible: class name method

Case sensitivity: attributes, array subscripts, and variables

Object passing: Reference passing

Object comparison: = = (Homogeneous object with same property value), = = = (Same object)

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

Auto Load: Must have class definition before instantiating object, auto Load (__autoload), auto load principle, auto load conflict (spl_autoload_register)

Class constants: Definition (const), memory partitioning, Access (class access, scope resolution operator, object Access (method)), self keyword, self and this difference

Static members: definition (Static), properties, methods, access (scope resolution Operators), static properties and constants access differences

Static and non-static methods differ ($this)

Magic method: __tostring () (Echo Object), __clone () (copied into different objects, cloning does not go through the construction method, block cloning (private))

Singleton mode: Concept (one class with only one object), reason (province resources), principle (three private one public)

Factory mode: Concept (Production object), reason (convenient management), Factory singleton mode

Object-oriented is not necessarily class (JS)

Three major features of OOP: encapsulation, inheritance, polymorphism

Encapsulation: Data and data manipulation, process of making classes, hidden object properties and implementation details (privatization), external use of interfaces (limited read and write)

Inheritance: One object uses the properties and methods of another object directly, reducing the duplication of code

Polymorphism: Many different implementations of the interface, not in PHP

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

Inheritance conflict: Override, Control level (subclass is weaker than parent class), Access parent class with the same name Method (parent)

PHP single inheritance, chained 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, the final class, the final method (which can be inherited but not overridden), abstract (cannot be instantiated), abstract method

Project design: Large project, multi-team (interface Specification, abstract class specification), small project (not used)

Interface: specifically specifies the structure of the class, Syntax (interface), interface body (constants and methods, cannot implement methods, only public), implement Interface (implements), subclasses must implement interface all methods, implement multiple interfaces

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

PHP Overloading: Handling When a user action does not exist or is not available for member properties or methods

Property overloading: __get (), __set (), __isset () (called Isset and Empty), __unset () (unset call)

Method overloading: __call (), __callstatic ()

Overload meaning: Limit user operation conditions, error correction

Object save and Restore: file_put_contents save, File_get_contents get, object cannot be saved directly

Serialization: Serialize

Deserialization: Unserialize,php_incomplete_class, cannot get original object reason (resource free), introduce class file to get original object, auto load class, database connection invalidation

Object save and Restore: __wakeup (), __sleep ()

Object judgment: instanceof, inheriting objects belong to subclass and parent class

Object involves method: Class_exists,interface_exists,method_exists,get_class (Gets the object class name), Get_parent_class (Gets the parent class name)

Object traversal: Property traversal, General foreach traversal, in-class foreach Traversal ($this), in-Class specific property traversal (iterator predefined interface)

"PDO": PDO, Function (portability), principle, configuration (extension)

PDO main classes: PDO (database connection, SQL Transfer), pdostatement (result set, preprocessing), Pdoexception (PDO exception handling)

PDO class: Constructor (DSN data source, user name, password), object destruction (not provided, unset,null), execute SQL (no result set EXEC (add-in), Lastinsertid; with result set pdostatement query), Error handling (ERRORCODE,ERRORINFO)

Pdostatement class: Correlation function (rowcount,columncount), traversing 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, first bound after assignment], Bindvalue[not recommended, first assignment after binding, each time to bind]), transaction processing (Begintransaction,commit,rollback)

PDO property setting: Setattribute,getattribute, property 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 interior (new Reflectionclass (Class), Getconstants,getproperties, Isstatic,getmethods)

Ecshop Installation: Virtual host, GD library extension, configuration database, configure background administrator, install test data, access backstage

Shopping system: Imitation ecshop make a small commodity management and shopping system

Features: Background user login (form, Session,cookie, verification Code), Commodity classification management (infinite Pole classification), Commodity management (file processing, thumbnail, watermark processing, paging, commodity batch management, WYSIWYG editor use), time permitting (foreground product browsing, shopping cart action, User management, etc.)

Design projects: Design projects from the Project manager perspective (Project Architecture (framework, source code, development model), coding structure (project directory Division, functional division)

Current popular development mode: Two development, framework development

Data schema: Data size, update frequency; two big database Camps (SQL,NOSQL), Primary architecture (table, table function, table structure, in-table data relations)

Front desk and backstage: Front desk (user see, display data), backstage (admin view, management data), front and rear desk by function division, art and programmer according to work content Division

Project directory structure, Code Division: Project Sub-background, admin for the background directory, front and rear public part of the foreground includes, background public file Admin/includes, front and rear have default access to the entrance index.php

Project code Design: The data is the core, the code is to access and manage the data; Data is stored in MySQL, PHP accesses the database via db.class.php (includes), logic is separated from the display, and public functions are packaged in class (file upload, image processing, paging)

Background User Login function design: Login form (login, verification code, exit, retrieve password, remember password), admin/templates/login.php, code from simple to complex; A class of transactions request a PHP file (login: admin/privilege.php)

Background Project initialization: Runtime Environment (Error level, error display), basic directory Constants, config file system, common code (auto load function, jump, etc.), admin/includes/init.php

admin/includes/init.php: Encoding settings (header), directory constants (__dir__, backslash handling, 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 profile: admin/includes/init.php, Profile directory constants, configuration file Globals ($GLOBALS [' config '])

Run environment settings: Ini_set () (error_reporting,display_errors), error level relationship

Login interface: From Ecshop, JS files, image files, CSS files

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

User Login Form Design: Request privilege.php, design hidden domain act,$_request (gpc,request_order,variables_order)

Verify user information: Design Administrator table (Library, table, field (ID, user name, password, registration time, last logon time and IP)), insert a data, receive user submitted data for validation, database operation (using DB class, one class per table (/includes/ adminTable.class.php))

Table class Design: Inheriting DB class, attribute (Table_name,fields)

Validation call Table class: Auto-Load (/includes/ function.php), the initialization file introduces the common function library, instantiates the Table object (incoming database connection information, connects the database), modifies the instantiation (automatic invocation of the configuration file in the DB Class), authenticates the user with the user name and password (correctly obtains the user information, error returns false), modifies the user password (MD5 encryption)

Working principle Analysis: User request to get verification result

Validation result processing: interface jump (Header,js in PHP document.location.href,html refresh), create jump template/admin/templates/redirect.php, jump function Admin_ redirect calling the Jump function in/includes/function.php,privilege

Verify that the user is logged in: Define variable judgments, get parameters, session data

Open session mechanism: Default off (php.ini Session.auto_start), Session_Start on, $_session (Access session data), session implementation of user login judgment

Session principle: Session_Start () Open session and read session file contents to $_session, script end will $_session content written to session file, and then release $_session variable

Session Cycle: Browser Close session invalidation, browser and server sessions process

Cookie session Technology: Server saves data in the browser, cookie principle, session and cookie Difference

Cookie use: Set cookies, obtain cookies ($_cookie and $_request), modify $_cookie (Invalid access again), cookie variable validity period, session failure principle, clear Cookie (Setcookie), Cookie directory distinction, cookie cross-domain, cookie in disguise save array

Session file: Storage (php.ini in Session.save_path)

Cookie file: Browser-specified storage directory, IE and FF differences, FF view Cookie file

Session Login Decision: User Login session record user information, index.php decision session information, initialization file open session

Simulate session implementation cross-scripting

Frame layout background: Use Ecshop background layout, index.php

index.php implementation: Consistent with privilege.php processing, using the Ecshop template

Log out: Clear session, jump to privilege.php landing page, top.php (target property)

User Information display: $_session, user last logon time (modify last logon time after login)

Session Depth: $_session can only be associative array, session can save the object, session expires by the cookie effect, session file Destruction (Session_destroy,$_session,setcookie), Session layering (Session.save_path, creating folders Manually)

Disable cookies after session use (other way to let the browser with SessionID), a tag automatically carry SessionID (Session.use_trans_id,session.use_only_cookie), PHP script Delivery (manually added, session_id (), Session_name ())

Verification Code: Verification Code meaning (anti-malicious request), principle (Completely Automated public Turing test to tell Computers and humans Apart (fully automated computer and human Turing Test), the verification code content is put to the image), Verification code flow (generate, save to session, add to image, user input, verify), compare Ecshop verification code

GD Library: Image processing extension, GD processing picture flow (create image resource (existing or new), manipulate picture (crop picture, modify picture, fill picture, thumbnail, write verification code), save or output, release resources)

Make verification code: Get Verification Code content, verification code is written to the session, verification code is written to the picture, verification code picture display to the form

Encapsulation Verification Code class: Complex verification code method (background color random, text color random, add pixel points, add interference line)

Project Application Verification Code: request action to obtain a verification code picture, verify the user login using the verification code, new Verification Code method (verification code in the Class), click on the Verification Code picture replacement verification Code (JS)

Save User Login Information: The cookie stores the record ID (user ID), determines whether the user is logged in (judging the session, determines the cookie), and increases the user information through the user ID method, dangerous

Product Classification: Data table Design (primary key, category name, sort, parent ID), insert data, category.php, Commodity Category list interface, modify connection (menu), Commodity classification class, call method of commodity classification, template display categorical data

Infinite Pole classification: principle (find top classification, sub-category), non-recursive implementation (specify parent category), recursion (recursive point, recursive exit), recursive principle, indent (hierarchy identifier), Sort by sort field

Construct table full name: Table name, DB Class table prefix, add table name construct in DB class, use in table class

Assigning Values to field properties: Adding the Get table structure method (get all keys, primary key)

Categorical file access validation: Put login verification into init.php, introduce init.php file validation, detach requests that require authentication (login related does not require authentication, $_server[' Script_name '],basename (), Dir_name ())

Classification operation: Add classification (add form, submit form, process form data, classify storage), classify specify superior classification, array receive data submit data, delete classification (prompt user (JS), determine whether the classification can be deleted (whether the last level), delete classification)

Edit Classification function: Process (user click menu to enter edit, display categorical data, user edit operation, submit form, process edit data)

Re-encapsulation gets data by ID method (repeat, put to DB Class), form add hidden category ID

Product Classification Complete: No product quantity, Category list cache (cache cached, update cache), unlimited pole classification zoom

Commodity Management: Data sheet design (modeled ecshop), data insertion, goods.php, complete product List (menu connection, action processing, data object manipulation, list template, icon)

Paging: Process (determine data display quantity, determine number of pages, limit), paging jump (first, previous, Next, end, number, drop-down)

Project pagination: Modify the profile (number of data bars per page), modify list function (page number, number of displays per page), modify list function (get total record count, data, two-dimensional array), modify call list function

Pagination class: Separate paging without data processing (parameters), HTML (tags, ID)

Delete Product: Processing method (Recycle Bin), add delete flag (modify data table), delete process (confirm (JS), modify delete flag, modify list function, update list)

Recycle Bin operation: Paging display (configuration file, paging class use), restore

New Product: Process (connection, action, table method, template, Tab function)

Insert Function Repeat: Add Insert method (DB class, validate array information, array piece together SQL, return insert result), invoke Insert function

File Upload: Post,enctype (mutipart/form-data), $_files (specially received file data, field description, error description (0 no problem, 1 out of size, 2 out of size, 3 parts uploaded, 4 not uploaded, 6 no Temp folder, 7 File Write Temp folder error), File Upload principle (PHP service side), Move temp file (move_uploaded_file), file validation (size, type, rename, Strrchar)

Image upload class: Configuration file (upload size, upload type (string), upload path), upload naming rules (do not repeat, keep the original suffix, easy to identify (prefix)), File upload process (error judgment, file size judgment, file type judgment, rename, upload success, return new file name), File processing failed item still uploaded (Error prompt)

Product Insertion Process review: Collect form data, set initial values (clicks), Upload file judgments, make thumbnail judgments, invoke models, insert data

Make thumbnails: Process (Get Picture resources (original map, target map), process (adopt, copy), save or output, release resources), sample (rectangular region OK)

Package thumbnail production: Data acquisition (original size, target graph size, function type use), thumbnail ratio (aspect ratio), thumbnail production process refinement (calculate the original width and thumbnail size, determine thumbnail sizes, create image resources (original, thumbnail), sample copy, save output, destroy resources)

Thumbnail filter: Thumbnail size fixed (not enough place filler, make thumbnail background) pros and cons (convenient design display, inconsistent with the original image)

Watermark Making: Logo on the image, two (text, picture), basic flow (original, watermark, merge)

Project watermark: Configuration file, process details (get the original source, judge the watermark resource, get the watermark resource, get the picture width, judge the watermark location, calculate the location of the watermark, determine the merging results, save, return the name of the watermark), modify the name of the uploaded image as a watermark map

MVC: Software design paradigm (model, view, controller controllers), input processing and output separation, MVC framework (functional partitioning m,v,c), PHP code development (mixed, display and logical separation, data logic separated from business logic), Action (c handles a class of transactions, C contains multiple actions), distinguishes (module modules, model, template templates)

Automatic security Update method: Patchwork SQL statements, updates, processes (clean invalid fields, patchwork SQL statements (Update section, condition), force set conditions (judging conditions, automatic analysis of conditions), return to execution results)

Auto Delete: Delete according to ID (single =, array in), flow (parameters add quotation marks, patchwork delete condition, return delete result)

Session Storage: Session into memory, session warehousing (modify session storage mechanism), session warehousing principle, modify the session system (session read and write function), modify the process (prepare read and write methods, Inform the session system (Session_set_save_handler ())

Session table Design: Fields (SessionID, data, expiration time)

Session method Perfect: Read (according to SessionID database query), write (according to sessionid,session data write or update data), open (Extract Public Connection database code), database connection resource scope, Destroy (delete data according to SessionID), recycle (based on configuration cleanup expired Session,expire field), Session configuration (Gc_maxlifetime,gc_probobility,gc_divisor)

Encapsulate Session Class: constructor (set session processor, array pass parameter, open session, turn on parent constructor), refine each method

Session Method execution order (read before collection), modify Read method (do not read expired data, read judgment expire), session destruction (stop writing method)

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.