tp5 cannot access new modules and can only access default modules. How to play?
saven
saven 2018-11-22 10:27:00
0
3
1588

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

saven
saven

reply all(2)
花开,若相惜

这样写

namespace app\admin\controller;

use think\Controller;

class Index extends Controller


Peter-Zhu

Automatically bind the entry to the module and close it

  • reply 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!
    匠心 author 2018-11-28 07:07:46
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template