douyujun0152 2019-06-08 12:51
浏览 58

删除Codeigniter CMS中的功能名称URL

when data pass in controller that time the data and function name pass into URL

localhost/project/course/Web-Development

the above example course is function name of controller but remove it and pass this URL

localhost/project/Web-Development
  • 写回答

2条回答 默认 最新

  • doujia2021 2019-06-08 13:04
    关注

    using remap function we can solve this problem

    code in controller

    public function _remap($method, $params = array())
    {
        if ($method == 'autocomplete') {
            return call_user_func_array(array($this, $method), $params);
        } else {
            $methodcall = $this->M_tl_admin->Validate_Web($method);
            if ($methodcall == 'course') //***course is your function name***
                return call_user_func_array(array($this, $methodcall), array($method));
            }
    }
    

    code in model

        public function Validate_Web($alias)
    {
        $res = $this->db->get_where('category', array('ctg_url' => $alias))->result_array();//category is table name and ctg_url is data pass in URL(Web-Development)
        if(count($res)>0)
             return 'course';
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊