Solar_Http_Response::redirectNoCache()

public void Solar_Http_Response::redirectNoCache ( Solar_Uri_Action|string $spec , int|string $code = '303' )

Redirects to another page and action after disabling HTTP caching.

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.

This effectively implements the "POST-Redirect-GET" pattern (also known as the "GET after POST").

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 calls setNoCache() to disable caching.

See Also



Local