thinkphp Call common/common.php function tip error undefined workaround, thinkphpcommon.php_php tutorial

Source: Internet
Author: User

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 ...

  • Related Article

    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.