0

私は次のようなURLを持っています

"www.site.com/index.php/details/productname"

codeigniter のそのリンクで 404 エラーが発生しますが、URL www.site.com/index.php/details/ は正常に機能しています。私はseoの方法でurlパラメータを処理したい。

4

1 に答える 1

1

/index/URL の一部にセグメント を追加する必要があります。http://www.site.com/index.php/details/index/productname/


そのようなURLを開きたい場合http://www.site.com/index.php/details/productname/

1) メソッドを定義する必要があります_remap():

public function _remap($method)
{
    if ($method == 'index')
    {
        $this->viewDetails($this->uri->segment(2));
    }
    else
    {
        $this->default_method();
    }
}

また

2)application/config/routes.phpファイルを使用

$route['details/(:any)'] = "products/viewDetails/$1";

ユーザーガイドから:

  1. routers.php
  2. _remap メソッド
于 2013-05-17T19:28:39.147 に答える