dosrmo0442 2017-01-25 11:28
浏览 22

too long

Probably, this sort of questions are asked before but those doesn't address my problem. Anyway, I'm using this routing settings in my applications/config/routes.php file

$route['most-popular-movies-(:num)'] = 'movies/search/popular/$1';

where

  1. Controller = movies
  2. Function = search
  3. Segment1 = popular
  4. Segment2 = (Page #)

Now, I want to get the two segments in my controller but it seams routing overwrites the segments and I'm just getting one segment i.e: most-popular-movies-1 when using $this->uri->segment_array()

Any Standard Solution?

EDIT:

I can use this method to split the URI inside my controller

explode('-', $this->uri->segment(1));

but this doesn't look to be a standard.

  • 写回答

1条回答 默认 最新

  • dongwen2896 2017-01-25 11:37
    关注

    Like this. use uri_string().

    $uri = $this->uri->uri_string();//most-popular-movies-1
    $segments = explode('-',$uri);
    //print_r($segments);.//array of segments
    echo $segments[1];//output popular
    
    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向