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.