Thinkphp5.1 两个项目设置两个入口文件。两个域名

thinkphp5.1默认访问public下的index.php入口文件。默认执行index模块下

现在有两个项目。要两个域名。需要再一个入口文件。test.php

在public下建立test.php入口文件

namespace think; define('APP_PATH',__DIR__.'/../application');

define('BIND_MODULE','test'); --绑定模块test

require __DIR__ . '/../thinkphp/base.php'; // 支持事先使用静态方法设置Request对象和Config对象 // 执行应用并响应 Container::get('app')->bind('test')->run()->send();----application下新建test模块

 

这样就可以啦。localhost/public/test.php

 

如果有遇到其他问题可以留言看到帮你解决。

 

你可能感兴趣的:(thinkphp5)