Home > Backend Development > PHP Tutorial > Introduction to how to retain filled-in information after PHP fails to submit a form

Introduction to how to retain filled-in information after PHP fails to submit a form

WBOY
Release: 2016-07-25 08:59:38
Original
1023 people have browsed it
  1. header('Cache-control: private, must-revalidate'); //Support page bounce
Copy code

2. Use the session_cache_limiter method.

  1. session_cache_limiter('private, must-revalidate'); //To be written before the session_start method
Copy the code

Attached, session_cache_limiter parameters: The meanings of several parameters in session_cache_limiter are: nocache: Of course it is not cached (for example: the form information is cleared), but public variables can be cached private: cache in private mode (for example: form information is retained, but is valid within the lifetime) private_no_cache: private mode but does not expire (form information is retained) publice: public mode, (form information is also retained)

Set cache expiration time: session_cache_expire function setting, the default is 180 minutes.

FAQ: session_cache_limiter("private"); The form information is retained, but if you modify the submitted information, the information presented on the form page is still the information in the cache, which cannot be automatically refreshed in time. If session_cache_limiter("private") is not used, it cannot be retained. Form information

Solution: Add in front of session_start:

  1. session_cache_limiter( "private, must-revalidate" );
Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template