Home >Backend Development >PHP Tutorial >ThinkPHP3.2 cannot load controller

ThinkPHP3.2 cannot load controller

不言
不言Original
2018-05-02 13:41:483917browse

This article mainly introduces the inability to load the controller in ThinkPHP3.2, which has certain reference value. Now I share it with you. Friends in need can refer to it

Unable to load Controller: Admin

Error location

FILE: D:\phpStudy\WWW\wisdom\ThinkPHP\Library\Think\App.class.php LINE: 101

   在将ThinkPHP3.1.3升级到ThinkPHP3.2.3时,即使将View、Mode、Controller放到了指定目录下也还是出现无法加载控制器的问题,经过一番研究,发现主要可能由几个原因引起。
  • 1

  • 2

  1. ##APP_USE_NAMESPACE (whether to use the namespace): When set to false, if a namespace is used when defining the controller, the controller will not be loaded. In this case, just set the parameter to true. Can be set in ThinkPHP/Common/Conf/convention.php.

  2. ACTION_BIND_CLASS (whether to bind methods and classes) : When set to false, the structure of the Controller folder should be Controller/View name Controller.class.php , methods are written one by one in the class; but when set to true, the structure of the Controller folder should be Controller/View name/method.class.php, and one class corresponds to one method.

  3. MODULE_ALLOW_LIST (allow access to modules) and MODULE_DENY_LIST (deny access to modules) : When the module is set to deny access or is not set to allow access in the list, all pages under this module cannot be accessed normally.

  4. URL_MODEL (URL access mode) : When it is not 0, if you use the U method to call the methods of other controllers under the module, you need to define BIND_MODULE Define the module, otherwise the current module cannot be recognized.

  5. Incorrect controller definition: The namespace must be defined in the first non-comment line in the controller, and pay attention to the class name when defining the controller Spelling, and whether the extends controller exists, often cause the controller to be inaccessible due to this small problem. (The case and spelling errors in the controller file name/even the Controller directory are the most common for novices to make this low-level mistake)

  6. ##BIND_MODULE ( Binding module)

    : If the module is bound in the entry file, the module cannot be included in the path, otherwise the controller cannot be accessed.


The above is the detailed content of ThinkPHP3.2 cannot load controller. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn