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 ! ! ! !
花开,若相惜2018-11-25 15:30:28
这样写
namespace app\admin\controller;
use think\Controller;
class Index extends Controller