有时候我们需要指定的IP来访问,需要设置下面的:
在config.php中添加
// 禁止访问模块
'deny_module_list' => ['common'],
// 设置某些ip可以访问指定模块
'allow_module_ip' => ['admin' => '*'],
// 默认控制器名
'default_controller' => 'Index',
需要修改框架代码
thinkphp/library/think/App.php
代码位置如下
public static function module($result, $config, $convert = null) {
if (is_string($result)) {
$result = explode('/', $result);
}
$request = Request::instance();
if ($config['app_multi_module']) {
// 多模块部署
$module = strip_tags(strtolower($result[0] ?: $config['default_module']));
$bind = Route::getBind('module');
$available = false;
if ($bind) {