Php dynamic function calling methods & advantages of non-relational databases

Source: Internet
Author: User
Php Dynamic Call Function Method & non-relational database advantages php Dynamic Call function method, the first reaction is the magic function underlined function, __autoload ,__ struct ,__ get, __set and other functions.
In fact, php provides call_user_func () call_user_func_array (), which can call functions dynamically. When implementing the MVC mechanism, after the router completes the dynamic routing, it will dynamically call the corresponding Controller method after parsing. Call_user_func is similar to call_user_func_array. it is only an array function that transmits the parameters of the function as an array. While call_user_func is behind the called function, and takes the parameter directly.
Check the validity of an ip address. The first response is to use the explode function to split the ip address and compare the size of the first element with 255 to determine whether the ip address is a valid ip address.
In fact, a reasonable judgment method should be to use the ip2long function for judgment. Because ip2long will return false if it is resolved to an incorrect IP address. Likewise, you can compare the obtained ini-type ip addresses with the given ip ranges to restrict ip addresses.
When the data volume of a table on the line is huge, you must update the fields of the table. Is there any good way?
First, enable the backup data table. Update the data table, and then import the data into the table with the updated data table structure.
I didn't think of relational databases for the moment. mysql is a particularly good implementation method. However, if nosql is enabled for non-relational databases, mongodb or even redis, there is no table structure restriction. Update Table fields without stopping online applications. Redis itself is the key-value type. without the table concept, adding, deleting, and modifying fields will not affect the use of online applications.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.