【问题标题】:I am facing issue in routing codeigniter我在路由 codeigniter 时遇到问题
【发布时间】:2020-12-18 06:13:08
【问题描述】:

我正在开发 php Codeigniter。我正面临路由问题。

 (:any)  = 'Softwareproductslist';
 (:any)/(:num)  = 'Softwareproductslist';

这是我的动态软件列表。 现在,我必须设置城市明智列表。我按照下面的方法做了,但它给出了问题。其他路线也死了。请帮帮我..

$route['(:any)/(:any)'] = 'Softwareproductslistwithcity';
$route['(:any)/(:any)/(:num)'] = 'Softwareproductslistwithcity'

【问题讨论】:

  • “我按照下面的方法做了,但它给出了问题。其他路线也死了。” - 这并不能解释问题到底是什么。您所说的路线“正在死去”是什么意思?实际发生了什么?请详细说明。
  • 其他页面由于路由问题出现 400 错误。并且图像未显示在此页面上。但在整个项目中图像工作正常。

标签: php codeigniter routes


【解决方案1】:

路线:

$route['cities/(:any)/(:num)'] = 'softwareproductslistwithcity/index/$1/$2';

控制器例如:

class SoftwareProductsListWithCity extends MY_Controller
{
    public function index($city, $num)
    {
        // your code
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-12
    • 2021-10-09
    • 2011-09-16
    • 2012-04-27
    • 1970-01-01
    • 1970-01-01
    • 2011-10-08
    相关资源
    最近更新 更多