重定向与Codeigniter中的重定向有什么区别? [英] Whats the difference between redirect and this in Codeigniter?

查看:40
本文介绍了重定向与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

这篇关于重定向与Codeigniter中的重定向有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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