如何处理偶尔出现的 302 HTTP 错误

发布于 2024-08-05 18:28:57 字数 106 浏览 3 评论 0原文

我读到,即使您确实收到其中之一,302 HTTP 错误也不应该频繁出现。问题是它们在我的脚本的页面重定向中出现十分之一。您以前有过这方面的经历吗?我正在使用一个名为 Kohana 的 PHP 框架。

I have read that 302 HTTP errors are not supposed to appear frequently even if you do receive one of them. the problem is they appear one out of 10 times in a page redirect in my script. Have you had any experiences with this before? I am using a PHP framework called Kohana.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

猥︴琐丶欲为 2024-08-12 18:28:57

302 不是一个错误,它是一个成功的响应,这基本上意味着“暂时移动”,并且经常用于在 Web 应用程序中执行重定向。

我不确定您正在做什么导致发生 10 次重定向,但您通过 302 重定向这一事实本身并不值得担心。

302 is not an error, it's a successful response, which basically means "Moved temporarily", and is quite regularly used to perform redirection in web applications.

I'm not sure what you're doing to cause 10 redirects to happen, but the fact that you're redirecting via 302 is not something to worry about, in and of itself.

爱你不解释 2024-08-12 18:28:57

302不是一个错误,它用于重定向到另一个资源(例如另一个页面)

302 is not an error, it's used for redirecting to another resource (e.g. another page)

回眸一遍 2024-08-12 18:28:57

对于 Kohana 2.3.4, url::redirect() 使用 302 方法。您可以指定不同的方法作为 url::redirect 函数中的第二个参数。源中显示了可用的方法:

    $codes = array
    (
        'refresh' => 'Refresh',
        '300' => 'Multiple Choices',
        '301' => 'Moved Permanently',
        '302' => 'Found',
        '303' => 'See Other',
        '304' => 'Not Modified',
        '305' => 'Use Proxy',
        '307' => 'Temporary Redirect'
    );

For Kohana 2.3.4, url::redirect() uses the 302 method. You may specify a different method as a second parameter in the url::redirect function. The available methods are shown in the source:

    $codes = array
    (
        'refresh' => 'Refresh',
        '300' => 'Multiple Choices',
        '301' => 'Moved Permanently',
        '302' => 'Found',
        '303' => 'See Other',
        '304' => 'Not Modified',
        '305' => 'Use Proxy',
        '307' => 'Temporary Redirect'
    );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文