phpweb development introduction experience learning notes

Posted by santillano at 2020-03-03

Phpweb development introduction experience learning notes


1、 Php web application development notice

1. Entry points

Three stages of programmer: Code farming (fast skills) - Engineer (long-term knowledge) - expert (research paper)

Three elements of programming: declared variables (system, global, field, etc.), data algorithm (application, comparison, calculation, etc.), control structure (change, judgment, cycle, etc.)

Three elements of class: encapsulation, inheritance and polymorphism

Php web application development can be divided into two ends: static HTML + CSS + JavaScript page or UI framework graphic design, dynamic PHP + MySQL page design or interactive data processing

PHP knowledge points: function, array, object-oriented

PHP operation and development environment: lwamp integrated operation environment Linux / windows + Apache + MySQL + PHP; strictly distinguish PHP source code error checking and debugging of common code editor and application project engineering test ide integrated development environment zendstudio / phpstorm

2. Programming teaches you how to think: 20 years of self-taught programming experience tells you that self-taught programming is a hard process and an inspirational process, but programming is an art, not a pure technology. Ideas are more important than code. Machines are used for work. People should think about it. Strong interest + correct method = quick start, e course + e textbook + PC test + PC project development = introduction + mastery. What is programming? Programming is to write a paragraph or composition in English. To get started quickly, English should not be too bad. Set a small goal: fast reading, fast experiment, fast reading, one theory and one hundred principles, 10 days to cultivate feelings, 30 days to cultivate interests, 100 days to train programming thinking and have programming ideas, and 200 days to complete a decent Web apps project

3. From Boulevard to simplicity, refinement and Perfection: web development is based on the idea of object-oriented OOP, with the idea of from Boulevard to simplicity, using lightweight tools (IDE) to develop high and dry goods (APP), cool, atmospheric, smooth and simple, but simple. "Friendly interface, elegant code and stable system" is the eternal pursuit of MIS programmers. The functionality, practicability and stability of MIS are mutually restricted. How to make a proper decision? It depends on in-depth practice and business needs to keep up with the trend of the times

4. Three elements of rapid development of web application: watching tutorials (videos), reading programs (documents), checking codes (tests), and repeating over and over again. Taking the completion of demo drilling of development project as the overall progress of learning and development plan, learning platform with questions in the development process to repeatedly demonstrate and complete the learning task, constantly improving the project engineering plan to subdivide the modules of learning and development The key points of the stage shall continue to promote the learning progress according to the first and second level network plan of the project development

6. PHP learning and development: try to start the development project with the object-oriented OOP idea, first modularize and encapsulate the class, then strive to improve the development efficiency with the general and quick method of calling the class, and start the development of webapp with the development and design concept of "from the road to the simple". Learning and development are divided into static and dynamic design programming courses according to web design content. The basic courses of static web learning content can refer to HTML + CSS + JS practice, the basic courses of dynamic web learning content can refer to PHP classic example development, and the actual project development can refer to PHP object-oriented project. When many people in large companies develop the same project at the same time, in order to let the front-end art industry develop The code is concise and clear, focusing on the static page design quickly. The template standard development mechanism can be used to professionally plan the project development project. For the development of APP template, please refer to Smarty for a comprehensive video tutorial. For the theoretical knowledge of APP framework development, please refer to tinkphp

8. Zero basic quick start method and skills: give full play to the advantages of personalized local PHP learning and development environment resources, and create two work platforms for learning and development. The learning platform (zendstudio workspace) is D: \ phpstudy \ www combined with the development platform (personal development space rk. Com) is D: \ phpre \ www \ rk combined, and the course learning and app project development are combined correctly The experimental results of the learning platform are provided to the project engineering development for use and inspection in a timely manner. Instead, the app project development is used to demonstrate and test the learning effect. The learning methods and ideas are adjusted in a timely manner to improve the learning efficiency, cultivate the programming interest, improve the spirit of vitality, promote happy programming with the achievement of daily course code test, and promote greater success with success

9. Compatibility of code migration: the downward compatibility of php7.0.0 officially released on December 3, 2015 is as high as 99.9%. However, most of the applications that can run stably and the methods explained in the open class are the old version code. In the process of web learning and development, if you want to directly migrate or copy and paste the non native code in the running environment of php7 after downloading, you must first pass the latest version of Zend Studio 1 3.5 or phpstorm 2016.3 test, and use it to develop new applications after the test is successful. Compatibility issues focus on database related PDO applications

10. Easy to learn happy programming: code is like poetry, programming is like poetry. Class "Hump naming method" and "Hump command method" are like the rhyme of poetry. Dreamweaver's automatic generation of source code is like "magician" playing magic. The fun of programming should have the elegance and Inspiration of composing poems and enjoy the pleasure of creation. A quick start doesn't mean a rush to success. Programmers surf in the programming sea, experience the fun of programming, combine work with rest, enjoy mountains and waters, have a good mood of relaxed and happy everyday, so as to create a valuable webapp boutique

11. Thinking determines the way out: when encountering new problems, don't tangle up and waste time, stop to sort out the ideas, or check the data, charge the battery, use the external brain and change a method, it will be solved and unexpected results will be achieved. Before each development, write down one or two short lines of ideas with urinal paper, and start to experiment quickly one by one according to the ideas. If it doesn't work, it will come back again, and then make new ideas and change a new method until the problem is solved. There is no way out of the doubt. There is another village. This method is called "notes thinking" development, which can solve big problems

12. Painful and happy: PHP is a language that is easy to learn and difficult to refine. In fact, how about every programming language? Programmers can't help but light up the night war and bear loneliness and loneliness alone. Learning and development are hot and confused. Every programmer has the same confusion. To be a qualified PHPer, learning and development must be prepared for suffering and loneliness. As the saying goes, "all one's life depends on one's self-help, no determination, no achievement". When you start, you should have the confidence of development and the fun of programming. You should stick to yourself, be painful and happy

2、 Summary of PHP web application development and learning

1. Array () is the bathroom cabinet number $key and the clothing in the cabinet $value, which declares a set of data. Declaring array is to create a set of cabinets. The output of array can be printed with print_r() or print function command var_dump(); array belongs to non custom function, and implements PHP function and method together with encapsulating custom function

2. The form or JS will submit static page information from the front end to the back-end PHP for processing through $_postsubmission data transfer, and $_getwill get the PHP output result of the transfer data

3. The object-oriented learning of the non graphical UI starts with the encapsulation of the class, understands the OOP from the attribute and application of the class, and applies the object to the development of webapp. OOPL (object oriented programming language) can improve the encapsulation, reusability and maintainability of the program, but it is only "yes". Whether it can realize these advantages depends on the application level of the programmer and designer. As far as PHP is concerned, it is not a pure object-oriented language, but you can still use PHP to write good object-oriented code. Class is the abstract organization of object, and object is the concrete existence of class. The instantiation of classes leads to the instantiation process of objects and individuals, which is actually the process from abstract classes to concrete objects. The design of a class needs to be able to fully display its most important attributes and methods, and distinguish it from other things. Only the class itself has meaning, from abstract to concrete instantiation. Class defines a series of attributes (private) and methods (public), and provides practical operation details. Methods can be used to process attributes, transfer variable values to subsequent programs, and let children inherit parent attributes. The object contains the specific value of the class property, which is the instantiation of the class. It is because of different properties that different objects can be distinguished. Quick start: it is recommended to deepen the understanding and understanding of Oop by using Dreamweaver graphical interface

(1) Definition of class

Class class name {}

Class names are named in the same way as variables. The first word should be capitalized

(2) Modifier for class

Public any public location can access the default

Protected in class subclasses can be accessed

Private private class can be accessed

(3) Intra class properties

The variables defined in the class should be decorated with modifiers, otherwise an error will be reported

(4) Intra class method

Functions defined within a class

(5) Construction method

The abstract work used to initialize a class is to make the class generic. It is generally used to assign values to member attributes. When a class creates an object, it will be called automatically. Note that the two underline elements of ",", should not be misspelled. Instantiation of a class is like "magic". It will have a shocking effect and be witnessed as a miracle

Public function {}

(6) Deconstruction method

It is used to do some final processing work for the class. When the object of the class is no longer used, some methods will be called automatically

public function __destruct() {}

(7) Class instantiation

Object name = new class name ([parameter list]);

Parameters are used to pass parameters to the constructor

(8) Access to member properties and methods within a class

Within class:

$this - property name [method name];

$this represents the current object

(9) Out of class reference

$object name - property name [method name];

(10) The static keyword is used to modify member properties or static methods in a class. The properties or method properties modified by this keyword belong to the whole class and do not belong to any object

(11) Intra class access

Self:: property name [method name];

(12) Out of class access

Class name:: property name [method name];

4. The core mechanism of Web Management Information System Development: develop MIS with MVC architecture, similar to three kinds of relations in database, and then complex business, which is shown in specific front-end and program, nothing more than four kinds of actions, four kinds of actions for database operation: add, delete, update and select. Furthermore, there are actually two kinds of four kinds of actions: reading and writing. Check for reading, add, delete, and change to write. The frequency ratio of reading and writing operations is about 10 to 1.

Interface, page, style, script, program, permission, database, overall architecture, local architecture, what do you want? Give full play to the characteristics of high-level language encapsulation, inheritance and polymorphism, so that the architecture and program are more secure, easy to use, stable, high expansion, high cohesion, low coupling and more powerful. In the development process, you should record the problems you encounter that are not easy to solve temporarily and the inspiration of the projects that flash by. Then, in the later modification and expansion or the development of the next project, you should absorb the excellent processing experience and try your best to avoid the problems that have already appeared. Only through this kind of repeated accumulation, their own handling of development details will become more and more perfect.

Php web development meets the needs of mobile office equipment. In a variety of apps applications, compared with the C / S architecture desktop application field, the B / S Architecture Web application field is more fashionable and practical, and has become the mainstream of development.

5. Classic phpstorm ide development phpweb MIS process (native development mode of front-end UI framework):

Basic idea: optimize and expand the PHP function application, install the composer phar dependency package globally in the PHP directory, and directly install and update the third-party applications such as whoops fault-tolerant processing technology, medoo database framework, phpexcel class library, twig template engine in the project directory through composer install / update. Through the trigger init.php, the user-defined constants and variables are passed to solve a series of development problems such as page linkage response in the front-end UI framework of MIS

Method steps:

Global installation of PHP dependency package composer - use composer to create project architecture - phpstorm local development

Load common function ① +

Load composer ② + ③ + ④ + ⑤

Programming and debugging trigger init.php integration ① + ②

Layer m reference ③ + ④

V layer refers to static pages and class libraries of h-ui or layui front-end framework

Layer C reference ⑤

① P ($var) debugging method

② Processing method of whoops capture error information

③ Referencing the medoo database framework

require ‘vendor/autoload.php’;

//Initialize configuration

$database = new medoo([ ‘database_type’ = ‘mysql’, ‘database_name’ = ‘name’, ‘server’ = ‘localhost’, ‘username’ = ‘your_username’, ‘password’ = ‘your_password’, ‘charset’ = ‘utf8’]);

④ Expand the function of phpexcel class library

Install or update phpexcel with composer, and flexibly use PHP ~ MySQL ~ Excel to complete business requirements tasks such as MIS data conversion, import, export, query, chart, printing, etc

⑤ Reference to twig template

require_once ‘vendor/autoload.php’; $loader = new Twig_Loader_Filesystem(‘/path/to/templates’); $twig = new Twig_Environment($loader, array( ‘cache’ = ‘/path/to/compilation_cache’, )); echo $twig-render(‘index.html’, array(‘name’ = ‘Fabien’));

While thinking, trying and adjusting functional structured programming, based on h-ui or layui front-end framework development, H5 high-rise UI and classic modular programming

When the project is launched and released for application, ③ + ④ can be directly referenced in the project core subdirectory independent of composer

⑥ Core content of project development

First select and deploy the front-end UI framework, and then create the corresponding database as required. The last thing left to do is "five steps" to easily complete the whole MIS development work

Step 1: information collection and warehousing (emp.xls and other templates)

Step 2: export the general spreadsheet with header title for daily business (default Xl5 is easy to convert into DBF) to realize paperless operation

Step 3: export graphic report directly with phpexcel to provide query use or paperless report transfer

Step 4: according to the practical business requirements of MIS, choose the front-end UI framework menu items and inner pages, and beautify or optimize the framework operation interface. Medoo completes the database management of layer m in the background, adds, deletes, modifies and queries the business information and the UI operation of layer V, so as to realize the association between business logic and view, especially to make full use of the pop-up box or pop-up layer to solve the business operation process guidance or program running status prompt To ensure that the user interface is friendly, practical and easy to use

Step 5: optimize the system through the third-party manufacturer's class library and plug-in to improve the system performance and stability

⑦ After the development is completed and the online test is passed, use composer to release updates and upgrade apps to the app store

*Publish your own package

Step 1: log in to GitHub and create a project

Step 2: terminal git clone project address

Step 3: enter the project directory and create the composer.json file: execute the command composer init

Step 4: fill in the configuration file composer.json according to the prompts

* package name /

* description

* minimum stability

* package type

* license

Step 5 command: git add

Step 6 command: git commit - M "change description"

Step 7 command: git push

Step 8: publish to and log in to your ID

Step 9: click submit in the upper right corner, paste GitHub connection, and then click Check

Step 10: add auto update webhook

Go to GitHub project and click Settings

Click left to navigate to webhooks & Services

Click add services on the right

Search package

Fill in the user token. The token can be found in the profile of the package

Paste the token and add service

Then click the generated package to display the screen

Click test service, and OK appears, indicating success

Note: after the binding is completed, when git submits the update, it will be synchronized to the package

Background template agile framework experience

User name: system password: 0000

He Zhubi: