Previous Page
_redirect()

Solar_App_HelloApp
_redirectNoCache()

Next Page
_render()

_redirectNoCache()

protected void _redirectNoCache ( Solar_Uri_Action|string $spec, int|string $code default 303 )

Redirects to another page and action after disabling HTTP caching.

Inherited from Solar_Controller_Page.

Parameters

  • (Solar_Uri_Action|string) $spec: The URI to redirect to.
  • (int|string) $code: The HTTP status code to redirect with; default is '303 See Other'.

Returns

  • (void)

Description

Redirects to another page and action after disabling HTTP caching.

The _redirect() method is often called after a successful POST operation, to show a "success" or "edit" page. In such cases, clicking clicking "back" or "reload" will generate a warning in the browser allowing for a possible re-POST if the user clicks OK. Typically this is not what you want.

In those cases, use _redirectNoCache() to turn off HTTP caching, so that the re-POST warning does not occur.

This method sends the following headers before setting Location:

<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>