dqe9657 2014-11-26 13:27
浏览 64
已采纳

从视图调用控制器中的函数并使用重映射在控制器中路由

Am not able to call a controller function from my view

This is my view code

echo "<a href='".$base_url."/qst/d/".$row['id']."' class='btn linkcolor'>DENY</a>";

which calls a controller qst and a function deny in it

here is my controller code

    public function _remap($method, $params = array()) {
        if ($method == 'd') {
            $this->deny();
        }
    }
    public function deny($id){
   }

am getting the error undefined varaible id.

also am getting Missing argument 1 for qst::d

can anyone tell me what's missing in the code so that it works?

  • 写回答

2条回答 默认 最新

  • duanji8887 2014-11-26 13:34
    关注

    Why not just use routes? In application/config/routes.php, add:

    $route['qst/d/(:num)']= 'qst/deny/$1';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错