search

Home  >  Q&A  >  body text

tp5 cannot access new modules and can only access default modules. How to play?

I want to access the admin module

public/admin.php

<?php
define('APP_PATH', __DIR__ . '/../application/');

define('CONF_PATH', __DIR__.'/../conf/');

define('APP_DEBUG', true);

define('BIND_MODULE','admin');
// 加载框架引导文件
require __DIR__ . '/../thinkphp/start.php';

?>

application/admin/controller/index.php

<?php
namespace app\admin\controller;
class Index {
	public function index(){
		return 'this is admin';
	}
}
?>

The path is: domain name/admin.php It just cannot be accessed. I wrote

<?php
	return[		
    // 入口自动绑定模块
      'auto_bind_module'  => true,	
		]
?>

in conf/config.php and it still cannot be accessed. I don’t know why? Rewriting it in

.htaccess will not work. Rewrite it as follows:

RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L];

Solution ! ! ! !

savensaven2199 days ago1564

reply all(3)I'll reply

  • 花开,若相惜

    花开,若相惜2018-11-25 15:30:28

    这样写

    namespace app\admin\controller;

    use think\Controller;

    class Index extends Controller


    reply
    0
  • 天蓬老师

    天蓬老师2018-11-23 11:18:26

    Automatically bind the entry to the module and close it

    reply
    0
  • 匠心

    Teacher, I am studying your course. I installed ThinkPHP using the PHP toolbox, created the directory mssah under WWW, and added the index.php test. The site domain name management settings are no problem. Settings --- website directory D:\myphp_www\PHPTutorial \WWW\mmsah, index.php in the WWW directory is always executed when running. You said "automatically bind the entry to the module and close it". I don't know how to turn off "the entry is automatically bound to the module" in the PHP toolbox. Thanks!

    匠心 · 2018-11-28 07:07:46
  • Cancelreply