Day 1: Understand variables and array content in seconds:
Target experience: Personal blog project. Quick review: How the Web and PHP work. Programming records: variable classification and creation methods; data types and common operations; definition and access of arrays; introduction to common array functions; project practice: quickly create blog front page templates; separate web page parameters from public parts. Goal: Let newcomers understand: include is far more important than hello world. The correct division of web page structure is the first step. Instead of seeing hello world, the correct idea is far more important than programming skills. If the direction is wrong, no matter how awesome the code is, it is worthless. There are always simple solutions to problems. Simple syntax should be preferred. If the requirements cannot be met, complex syntax or homework should be considered: write out the basic page structure; separate the header and tail into independent php files, and then include them. Create the variables to be used in the current page in the public header file, such as title, keywords, description, etc. Create these website variables in two ways: independent variables and arrays, and import them separately. Use the get method to import page variables
The second day: Understand process control and function content in seconds: the normal execution process of the script if single branch and if ~ else multi-branch switch structure and usage occasions loop foreach() and alternative syntax The creation of loop while() function and the usage occasions and precautions of common types of functions. Example 1: Use table format to output the data in the array. Example 2: Encapsulate the above example into a function to achieve the same functional goal: flow control of if judgment. The example code is more intelligent and has stronger adaptability; looping is the key technology to realize the automatic operation of the code, which greatly simplifies the program design; the function is to give a name to a certain piece of code, so that it can be called later, and is an important means of code reuse; Understand the usage skills of if and foreach in html templates. Currently, you can work with only these two. Homework: Use if to judge leap years and use foreach to complete the output of the two-dimensional associative array on the page
Day 3: Understand MySQL content in seconds: use phpMyAdmin or Adminer to create databases, tables, and data types; the basic process of operating MySQL with PHP (from connection to closing): MySQL query operations and result set processing: understanding the results The relationship between sets and arrays; master the basic process of processing result sets; master the basic functions or methods of commonly used result set processing. MySQL's new, updated and deleted operations: master the basic query conditions; master the basic structure of the code; master the error mechanism processing plan. Example: Encapsulate the CURD operation into a function to facilitate calling in subsequent practical projects. Goal: Understand the purpose of using the database? Familiar with the basic process of operating a database in PHP. Commonly used functions for parsing result sets: mysql_fetch_assoc(), etc. Familiar with how to correctly output data table query results in HTML templates: encapsulate common add, delete, modify, and query operations into a function. [Optional] Encapsulate commonly used add, delete, modify, and check operations into a public class.
Day 4: Practical combat 1: Personal blog project structure and model design content: overall project framework, separation and import of public parts; configuration files and public functions to further standardize the project ; Complete the data table design. In order to simplify the project, since it is a personal blog, there is no need to register and log in, only the column table and article table are enough. Add demo data to the table in preparation for the next day of class. Goal: How to scientifically and quickly divide the project structure; simplicity and practicality are paramount. It is not necessary to copy the design pattern, but to use it flexibly. Homework: Complete the content in class, create the same project structure and data table as the teacher, and fill in the sample data
Day 5: Practical Combat 2: Home Page and List Page , Details page design content: Home page template design. Website parameters are called in the template. Using a single-entry design template, each column or page uses get parameters to call to complete the template design of the home page, list page, and details page. Create a template import function in the configuration file to complete the template import goals: quickly understand some page layout common sense on the front end; have a certain understanding of the mutual calls between various pages; and have a deeper understanding of the role of the configuration file. Homework: Complete the homepage and other pages; learn to use configuration files to import page parameters and public functions
##Day 7: Online Q&A: I’m not afraid of low questions, but I’m afraid that if you don’t say anything, the complaints will be more intense~~
PHP Chinese website (www.php.cn) September 5, 2017