codeigniter url包含前导斜杠的段

Joh*_*ohn 1 php uri codeigniter

访问该方法的url是这样的: http://localhost/site/cont/method 我想使用这样的GET方法访问此方法: http://localhost/new-tera/paper/lookup_doi/segment但我的segment部分已经包含/如下:

http://localhost/lookup_doi/segment/containing/slashes 请注意,整体segment/containing/slashes是一个值.

我在我的方法中得到这个值,如下所示:

public function method ($variable)
{
  echo $variable;
}
Run Code Online (Sandbox Code Playgroud)

//输出:segment

而不是:segment/contains/slashes

Ry-*_*Ry- 6

CodeIgniter将其余的作为附加参数传递.您可以指定其他参数(如果数字是固定的)或使用:

implode('/', func_get_args())

得到整个字符串.