包含前导斜杠的codeigniter网址段 [英] codeigniter url segments containing leading slash

查看:83
本文介绍了包含前导斜杠的codeigniter网址段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

the url to access the method is like this: http://localhost/site/cont/method I want to access this method using GET method like this: http://localhost/new-tera/paper/lookup_doi/segment but my segment part is already containing /like this:

http:/ / localhost / lookup_doi / segment /包含/斜杠
请注意,整个 segment /包含/斜杠是一个值。

我在这样的方法中得到了这个值:

I am getting this value in my method like this:

public function method ($variable)
{
  echo $variable;
}

//输出:细分

而不是:segment /包含/斜杠

and not : segment/containing/slashes

推荐答案

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

CodeIgniter passes the rest of them as additional arguments. You can either specify the additional arguments (if the number is fixed) or use:

implode('/', func_get_args())

以获取整个字符串

这篇关于包含前导斜杠的codeigniter网址段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆