Thinkphp calls the common/common.php function to tip the wrong function undefined workaround, thinkphpcommon.php
This paper mainly introduces the solution to the error function undefined called by thinkphp call common/common.php functions. For a friend who uses thinkphp for project development, this kind of problem is often encountered after the thinkphp upgrade. Described below:
The latest version of ThinkPHP3.2 was used after the thinkphp upgrade, and the general function was put into common/common.php, but a function undefined error occurred when invoking the functions on the specific page.
After reviewing the official documentation, it was found that the original ThinkPHP3.2 version common.php file has been renamed Function.php,
So the common.php---> Changed to function.php, the function call succeeds! Problem Solving!
It is hoped that the method described in this article will be helpful to thinkphp development.
The method in the common folder in the Thinkphp project
1, thinkphp project inside the common folder public method how to name how to use:
Create a common.php file under the Common folder (this is fixed)
-
You can customize functions in the common.php file, such as function AA ($STR) {...}, functions with arbitrary names, arbitrary parameters
-
about how to use, in 2 places, one is a controller (i.e. action, such as loginAction.class.php), you can call functions directly, such as AA ($title); The other is in the template file, you need to add "|" Separated, such as {$title |AA}
-
Most importantly, each time you change the common.php file, you need to delete the ~app.php file under the Temp folder, because common.php is first parsed into the ~app.php file and then called.
2, this simple, such as class Indexaction extends loginaction{...}, note: Action name I general initial capital, lowercase do not know the line is not OK, the proposed capitalization, the corresponding model name also uppercase, specification
How do I define and invoke custom functions in thinkphp?
Common/common.php directly in the method is written in the file inside the line! You can write your own way! But you need to use your method to call the file you wrote! There is thinkphp is not a single module entrance, find their files to put your files in the inside reference on the line! In this way can be used directly!!!!
http://www.bkjia.com/PHPjc/869452.html www.bkjia.com true http://www.bkjia.com/PHPjc/869452.html techarticle thinkphp Call common/common.php function undefined solution, thinkphpcommon.php This article mainly introduces thinkphp call common/ common.php function hint Error functi ...