我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

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

Looking at a router I find this $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();

call index function of controller. Where $controller has the name of controller class. So as per oops you are calling index function by using scope resolution operator (::).

近期文章

  • 检查会话ID是否在此代码中
  • SQL行选择的比较不起作用?
  • 如何加快我的cron作业/数据库更新速度
  • LARAVEL:如何将数据从视图发送到控制器
  • 如何在PHP中的URL之间追加一个字符串
  • 如何获取用户名和匹配的ID为Session?
  • 如何找到某个XML-Element并将其添加为新的?
  • 将数据从HTML表单发布到PHP操作脚本
  • 将cpanel数据库复制到本地机器后使用
  • 如何检查两个md5加密值是否相同或不使用PHP?
  • 获取数组中的前导者和后继者的数量
  • 更新/编辑值时,从输入字段的占位符中获取数据库的值
  • 在ajax调用之后获取旧数据(get方法)Laravel 5.5
  • 用ajax更新数量
  • 在一个位置连接php变量
  • 路由未定义php laravel5.5
  • 使用codeigniter创建数组输出(json)
  • 从可变长度2维数组中发布数据
  • PHP表单验证不起作用
  • PHP simplexml_load_file - 如果它是空的,则忽略xml对象

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华