在codeginiter重定向函数中的位置和刷新之间有什么区别? [英] What are differences between location and refresh in codeginiter redirect function?

查看:185
本文介绍了在codeginiter重定向函数中的位置和刷新之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道Codeigniter redirect()函数中位置 referesh 之间的区别是什么?

I would like to know what are differences between location and referesh in Codeigniter redirect() function?

http://ellislab.com/codeigniter /user-guide/helpers/url_helper.html

推荐答案

它不需要只使用Codeigniter。这些是您可以用来重新加载(或重定向)页面的两种方法。

It does not have to do only with Codeigniter. These are the 2 methods that you can use to reload (or redirect) a page.

使用位置:您要向客户的浏览器发送 3xx状态代码(通常为301或302),通常表示该内容具有暂时移动。使用适当的代码将向客户端提供有关执行重定向的原因的更多信息。这将对搜索引擎特别有用。

With Location: header you are sending a 3xx status code (usually 301 or 302) to the client's browser which usually indicates that the content has temporarily moved. Using the appropriate code will give more information to the client about the reason you are doing the redirection. This will be useful especially for search engines.

此外,浏览器不必在执行重定向之前下载所有页面的内容,但它会立即获取状态代码从服务器,它会转到新的页面。

Also the browser does not have to download all the page's content before doing the redirect but it does it immediately as it gets the status code from the server and it goes to the new page instead. This way you do not break the 'back' button of the browser.

使用刷新元标记或HTTP标头您可以向客户端的浏览器发送请求,以刷新页面,而不会显示有关您执行此操作的原因或原始内容和新内容的任何信息。浏览器必须首先下载所有页面内容,然后在刷新中指定的时间(以秒为单位)之后,它将重定向到其他页面(通常为0秒)。

With Refresh meta tag or HTTP header you send a request to the client's browser to refresh the page without indicating any information about the reason you are doing it or the original and new content. Browser has to first download all the page content and then after the time (in seconds) specified in the Refresh it will redirect to the other page (usually 0 seconds).

此外,如果用户点击浏览器的返回按钮,它将无法正常工作,因为它会带他到上一页,它会再次使用刷新

Also if a user hits the 'back' button of his browser it will not work as it should since it will take him to the previous page and it will use Refresh again and send him to the next from where he pressed the button.

以上声明根据W3C文章此处

Above statements are according to W3C article here

这篇关于在codeginiter重定向函数中的位置和刷新之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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