[英]Codeigniter url redirecting from address url
I have a problem with codeigniter, i can't find a resolv. 我有codeigniter的问题,我找不到resolv。
How can i make a redirect by parsing into url the destinations url without interpreting the / as a separator betwen controller model etc. 如何通过解析到url目标url而不解释/作为控制器模型之间的分隔符来进行重定向。
For example: 例如:
http://www.example.com/http://www.google.com/?q=test
what it shoud do to thake http://www.google.com/?q=test
as a string and put it into 将
http://www.google.com/?q=test
作为一个字符串并将其放入其中的做法应该做些什么
Header("Location: http://www.google.com/?q=test");
any ideeas ? 任何想法?
You can use the url helper's redirect function. 您可以使用url helper的重定向功能。 If you give it a full address (with http://), it will redirect to that external url.
如果您给它一个完整的地址(使用http://),它将重定向到该外部URL。 https://ellislab.com/codeigniter/user-guide/helpers/url_helper.html
https://ellislab.com/codeigniter/user-guide/helpers/url_helper.html
redirect("controller_name/function_name");
this code is using header function in php
这段代码
header function in php
使用header function in php
it is equivalent to base_url() + redirect value
它相当于
base_url() + redirect value
I success make that, 我成功了,
I used url library like has sugest Juul , and the code is like (in controller): 我使用url库就像有sugest Juul ,代码就像(在控制器中):
class url extends CI_Controller {
function index() {
# the codeigniter not accept the characters after ? and i make a custom code
# to know where is the ? sign and then i replace http:/ whith two //
$url = str_replace(":/","://",str_replace('%5E','?',$this->uri->uri_string));
#the url var will return http://www.google.com/?q=test
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.