PHP common Error handling Fatal error (1) ---- function undefined I. Error type: PHP Fatal error type: PHP Fatal errorFatal Error: Call to undefined function (a) in (B) on line (c) 2. Error Description: This error report indicates that you are calling an undefined function. a ---- indicates an undefined function name; B ---- the path of the script section appears; c ---- attempts to call the row number of the undefined function. D ---- the row number when the function is defined for the second time. Iii. Cause and solution: cause 1: You have not declared this function. For example, directly calling the following function myFunction (); // here there is no such function result: Fatal error: Call to undefinedfunction myFunction () in (path) on line 1 solution: check whether the function is declared in your program. Cause 2: The name you used in the function declaration is different from the name you used in the call, for example, function myFunction () {// do something} myFuntion (); // write less than the letter C here to solve: this is the easiest mistake for many beginners. Sometimes it takes a long time to check whether a letter is missing or not written. Cause 3: errors generated when you call the new PHP built-in functions in the old version of PHP. Because this PHP built-in function does not exist in your old version. For example, you Call mime_content_type () Fatal error: Call to undefinedfunction mime_content_type () in the old PHP version. Solution: Open the PHP manual and carefully check which built-in functions are applicable to PHP. The PHP Manual specifies detailed version limits for each built-in function. For example (PHP 4> = 4.3.0, PHP 5). Therefore, the solution is to upgrade your PHP version or change other built-in functions of the same type. Cause 4: Your code for calling the function is written in a file different from the function declaration. For example. the PHP file writes this code myFunction (), while your function declaration is in B. function myFunction () {// do something} in php solves the problem: this usually happens to PHP beginners, when they call functions, they forget that PHP will not automatically associate or reference files. That is to say, in the above case, a. php and B. php do not have any relationship at all. At this time, you need to use functions such as include () to associate the two. Cause 5: Your code for calling the function is written in a file different from the function declaration. You have also introduced this file. However, your function call code is located before the file code is introduced. For example. php executes the function call, while B. declare function a in php. php code myFunction (); include ('B. php '); B. php code function myFunction () {echo '000000';} solution: an error will be reported during execution like the above Code. Because PHP cannot find the declaration of the function when executing the function call. Therefore, do not write the function call before the function declaration file is introduced. Of course, if you are in the same PHP file, you can write the called function before the function declaration. Cause 6: You define a function using the same name twice in a row. For example, function myFunction () {} returns the following Fatal error: Cannot redeclare myfunction () (previusly declared in (path): 2) in (path) on line 1 solution: Find the declared function and see what causes you to define it again. If you simply forget that you have previously defined the statement, delete it. Of course, your situation may be complicated. For example, if the arrangement of your script files is exceptionally messy and you may use a large number of include () functions, it will make it difficult for you to clarify your ideas from the chaotic code.