简体   繁体   English

这个$ controller :: Index()是什么意思?

[英]what does this $controller::Index() mean?

Looking at a router I find this $controller::Index(); 看着路由器,我发现这个$controller::Index(); , what does this mean? , 这是什么意思?

$router->map( 'GET', '/[a:controller]/', function($controller, $action = 'index') {
    if( method_exists( $controller, $action ))
        $controller::Index();
    else
        echo 'missing';
});

what does this $controller::Index() mean? 这个$ controller :: Index()是什么意思?

$controller::Index();

call index function of controller. 控制器的调用index功能。 Where $controller has the name of controller class. 其中$controller具有控制器类的名称。 So as per oops you are calling index function by using scope resolution operator (::) . 所以,按照oops你调用index使用函数scope resolution operator (::)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM