php function

Callback

The callback function is just a variant of the variable function, and it is essentially the application of the variable function.

In a function (A function), another function (B function, C function) is called through the variable function method $var(), and its function name is passed in through the parameters of the A function, this method is the callback function , because the variable function $var() in function A will pass in different actual parameters according to the user, and then call back to other functions with different names (B function, C function)

Format:

function A($var){
     $var();//Callback function element 1: variable function
}

A('B')//Callback function element 2: incoming function name string

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325024178&siteId=291194637