PHP micro-Credit Public Development notes (v)

Source: Internet
Author: User
Tags add exit functions include key words connect php code query
PHP micro-Credit Public Development Note series Date: 2014.9.3
Today did the authentication function, then perfected the next search function. In fact, the main thing is that the entire code structure has been sorted out, it should be said to be modular design it.
Modular design of our public number. Because we mentioned before the functional requirements are: 1, menu--query function. I thought about the extension of later functions and wanted to implement these modules: Menu module (in this way, we need to add a new menu function in the future, you can directly operate in this module, so that the correction and maintenance is also simple, in view of the later may be the division of labor collaboration between the developers will not conflict); 2. Database Module ( This is mainly responsible for database related work, such as add, modify, query, etc., this is the two functional requirements proposed at that time. Then I thought to myself, the public number is not just for the query work, so I have the following idea: 3, sometimes may need to interact with what, so I will "menu" as our implementation of the menu module entrance, that is, send "menu" will enter the service number of the menu module, and then send "query" instructions, has entered the specific query function. and send "Exit" To exit the menu module. 4, after we quit the menu module, the user sent the instructions will be called Keyword Capture module to respond to the user's operation, capture specific user instructions to interact with the user.
5, some operations, such as the resolution of the database address information, some key words to restore tips and other common functions, we should be able to encapsulate as a module of operation.
Based on the above considerations and ideas, we now have the public Code directory structure: PHP code, there is no error prompted (do not know), so many grammatical errors can only be uploaded to the SAE after I sent a message to check to get (of course, this also shows that I am sloppy), often: either the function name is wrong, Either the function parameter name is wrong, or the statement is less the semicolon ending, or the variable before the $ symbol ... A lot of such mistakes; 2, database: Do the account information authentication, because this authentication before I search function, so forgot to connect to the database first. Then I was doing the certification, because to find the information in the database, but I did not connect to the database, so I have been looking for error lookup errors ... Toss for a long time, this also exposes me not careful of the problem; 3, require/include/require_once/include_once these abuses. PHP seems to be unable to repeat the include, require files, so there are require_once, include_once these two. My understanding of the inability to duplicate it was that the same file could not be duplicated (it always appears that the function was contained multiple times), and then I knew it was not meant to be. My current approach is that the functions inside the tools, I only include in the index.php, and then the functions in the module operate with require_once, because I might call the function between the modules, and if you use include, you do not guarantee that the inclusion relationship can be handled well.

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.