TP5中怎么获取当前模块当前控制器呢?
方法可能有很多种,这里只是提供一种
可以在控制器中通过中Request实例化类获取当前模型/控制器/方法
use think\Controller;
class Index extends Controller
{
public function test(Request $request)
{
$this->assign('controller',$request->controller());
$this->assign('module',$request->module());
$this->assign('action',$request->action());
}
}
/*视图文件中
{$controller}
{$module}
{$action}
*/