【问题标题】:How to pass controller name throught query string Codeigniter如何通过查询字符串 Codeigniter 传递控制器名称
【发布时间】:2014-07-11 21:51:06
【问题描述】:

当控制器名称在文件夹中时如何传递。

index.php?c=welcome

我试过这个index.php?c=A/welcome,它不起作用。

【问题讨论】:

    标签: php codeigniter url url-rewriting codeigniter-url


    【解决方案1】:

    配置文件有这样的:

    $config['controller_trigger']   = 'c';
    $config['function_trigger']     = 'm';
    $config['directory_trigger']    = 'd'; 
    

    上面写着:"// experimental not currently in use"

    我查看了处理此问题的路由器类,它似乎使用传入的值 ?d= 来设置目录...您可能想尝试一下。

    看起来像

    index.php?d=A&c=welcome
    

    【讨论】:

      【解决方案2】:

      只需在控制器之前传递文件夹名称并在其后附加变量。喜欢

      • index.php/文件夹名/控制器名/函数名

      注意: “index.php”的使用主要取决于您,因为您已经与其他人一起使用它们。

      【讨论】:

      • 兄弟我知道如何像这样传递..我正在尝试从查询字符串 index.php?c=a/name
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多