【问题标题】:what does this $controller::Index() mean?这个 $controller::Index() 是什么意思?
【发布时间】:2017-11-25 12:36:16
【问题描述】:

查看路由器我发现这个$controller::Index();,这是什么意思?

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

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

【问题讨论】:

  • 什么是框架?
  • 调用index控制器函数。
  • @FirstOne, altorouter
  • @urfusion,谢谢

标签: php altorouter


【解决方案1】:
$controller::Index();

调用控制器的index 函数。其中$controller 具有控制器类的名称。因此,根据oops,您正在使用scope resolution operator (::) 调用index 函数。

【讨论】:

    猜你喜欢
    • 2019-04-01
    • 2015-06-08
    • 2011-04-11
    • 2018-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-13
    • 2017-05-25
    相关资源
    最近更新 更多