重定向与Codeigniter中的重定向有什么区别?
我是Codeigniter的新手,它是php的良好框架之一。但是在某些情况下,我很困惑。像这个。如果您对我的面团有任何澄清,对我有很大的帮助。
Offcouse重定向刷新页面,而$ this除了我想知道的以外,无论如何,它们都曾经去过视图页面上的其他地方,或者就像在其他控制器或同一控制器中的其他方法一样。
但是我们不能并排使用它们,因为获取它们中的任何一个时,它们都将转到该页面或方法而无需检查下一行。
I am new in Codeigniter and it's one of the good frameworks of php. But on some conditions I'm confused. Like this one. If any of you have any clarification about my dough, it's a great help for me. Offcouse redirects refresh the page and $this not but apart from this I want to know - anyhow both of them used to go to somewhere else on view pages or like in other controller or in same controller to other methods. But we don't use these side by side because when getting any of them it will go to that page or method without checking the next lines.
在正常差异的情况很多,但是我只想知道当我们使用重定向或像这样的$ this时转到下一页或方法的情况-
In case of a normal difference then have lot's of but I just want to know about the condition of going to next page or method when we use redirect or $this like this -
$this->Function($value); //It's method of same controller.
redirect('Controller/function'); //It's also doing same with page reload.
感谢您查看我的问题。
Redirect()
当您在codeigniter中调用helper的任何函数时,可以直接调用函数而无需使用任何对象。 Codeigniter中的Helper是函数的集合。
Redirect() When you will call any function of helper in codeigniter then you can call function directly without using any object. Helper in Codeigniter is collection of functions.
Redirect()方法是Codeigniter中URL helper的一部分。
供您参考。 https://www.codeigniter.com/user_guide/helpers/url_helper.html
Redirect() method is a part of URL helper in Codeigniter. For your ref. https://www.codeigniter.com/user_guide/helpers/url_helper.html
因此,只需使用$ this-> load-> helper('url');加载帮助程序;
So, just load helper using $this->load->helper('url'); or you can also mention in autoload.php file.
$ this-> Function(); 用于从同一控制器调用函数
$this->Function(); used to call a function from same controller