`
ping8899
  • 浏览: 43708 次
社区版块
存档分类
最新评论

php session_cache_limiter详解

阅读更多

    <span style="background-color: #eeeeee;">
</span>

<h2 style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; line-height: 19px; margin-top: 10px; font-size: 1em;"><a id="ctl09_TitleUrl" style="color: #0000ff; text-decoration: none; font-size: 13px;" href="http://www.cnblogs.com/kaixin110/archive/2010/09/06/1818830.html">session_cache_limiter(private,must-revalidate)是什么意思</a></h2>
<div id="cnblogs_post_body">
<ul class="row-1" style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-left: 45px; border-bottom-width: 0px; border-bottom-style: none; border-bottom-color: initial;">
<li id="articleContent" class="pro-content">

<div>
<div style="width: 760px;">
<p style="font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">表义一:

<p style="font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">表义二:



</li>
</ul>
<p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">?

<p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">?

<p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">?

<ul style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-left: 45px;">
  • 1.使用session_cache_limiter方法:

  • </ul>
    <span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: x-small;"><span style="line-height: 19px;"><span style="white-space: pre;"> </span></span></span>


    <span style="line-height: 19px; white-space: pre; background-color: #fafafa;">session_cache_limiter('private,must-revalidate');  </span><span style="background-color: #eeeeee;">
    <div>
    <span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: x-small;"><span style="line-height: 19px;">?<br></span></span>
    <p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">但是要值得注意的是session_cache_limiter()方法要写在session_start()方法之前才有用;

    <ul style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-left: 45px;">
  • 2.用header来设置控制缓存的方法:

  • </ul>
    <p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">?

    <p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">第一,使用Header方法设置消息头Cache-control?<br>引用:<br>header('Cache-control: private, must-revalidate');//支持页面回跳<br>第二,使用session_cache_limiter方法?<br>引用:<br>//注意要写在session_start方法之前<br>session_cache_limiter('private, must-revalidate');

    <p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">Public指示响应可被任何缓存区缓存。

    <p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">no-cache指示请求或响应消息不能缓存

    <p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">max-age指示客户机可以接收生存期不大于指定时间(以秒为单位)的响应。

    <p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">max-stale指示客户机可以接收超出超时期间的响应消息。如果指定max-stale消息的值,那么客户机可以接收超出超时期指定值之内的响应消息。

    <p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">问:为什么我在点击浏览器的后退按钮后,所有字段的信息都被清空了?

    <p style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px;">补充:还有基于session的解决方法,在session_start前加上?<br>引用:<br>session_cache_limiter('nocache');// 清空表单<br>session_cache_limiter('private'); //不清空表单,只在session生效期间<br>session_cache_limiter('public'); //不清空表单,如同没使用session一般


    </span>
    ?

     
    0
    0
    分享到:
    评论

    相关推荐

      PHP提交表单失败后如何保留填写的信息

      PHP 提供了多种缓存方式,包括使用 header 头设置缓存控制头 Cache-control、使用 session_cache_limiter 方法等。 使用 header 头设置缓存控制头 Cache-control 可以使用 PHP 的 header 函数来设置缓存控制头 ...

      FCL.rar_Limiter_current limiter_fault current_fault limiter_fcl

      【标题】"FCL.rar_Limiter_current limiter_fault current_fault limiter_fcl" 提供的信息表明,这是一个关于电力系统中故障电流限制器(Fault Current Limiter, FCL)的MATLAB Simulink模型。FCL是一种重要的电力...

      php session_start()出错原因分析及解决方法

      这时,如果再次尝试启动会话,就会出现“Cannot send session cache limiter – headers already sent”警告,因为HTTP头部信息已被发送。 解决这个问题的方法是在调用session_start()之前使用ob_start()函数开启...

      Alamshekan.rar_coordination_current limiter_fault limiter_stabil

      Transient stability enhancement by bridge type fault current limiter considering coordination with optimal reclosing of circuit breakers

      基于session_unset与session_destroy的区别详解

      - session.cache_limiter和session.cache_expire用于控制会话页面的缓存问题,影响到HTTP头信息的设置。 - session.use_trans_sid用于启用或禁用透明sid支持。 - url_rewriter.tags用于定义URL重写时应重写的标签...

      FPS_Limiter_0.2

      FPS_Limiter_0.2是一款专门用于限制Direct3D 9和8以及OpenGL接口游戏帧率的工具。这个软件的主要目的是让玩家能够自定义游戏的帧数上限,从而实现更稳定的性能表现或节省电源。在游戏开发和优化中,帧速率(FPS)是...

      php session_start()关于Cannot send session cache limiter - headers already sent错误解决方法

      在windows下编程,当使用session_start()方法的时候,有时会报session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/...

      withsfcl2.rar_SFCL_fault limiter_power system fault_sfcl matlab

      标题中的“withsfcl2.rar_SFCL_fault limiter_power system fault_sfcl matlab”指出这是一个关于半导体故障限流器(SFCL)在电力系统故障中应用的MATLAB模型。描述中的“semiconductor fault limiter (SFCL) in ...

      游戏帧数自定义工具FPS_Limiter_0.2

      游戏自定义帧数工具FPS_Limiter_0.2使用方法: 由于此工具是用java编译的 所以需要 先安装java才能正常运行 java下载: http://www.java.com/zh_CN/download/windows_ie.jsp?locale=zh_CN&host=www.java.com 安装...

      解决php中Cannot send session cache limiter 的问题的方法

      今天在使用php 的session 的时候,出现了以前就遇见但是又解决不了的问题,在页面上出现如下提示: Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers...

      阿里云Session.docx

      由阿里云CE平台提供,一些与Session相关的设置函数如`session_cache_expire`、`session_cache_limiter`、`session_get_cookie_params`、`session_set_cookie_params`、`session_save_path`、`session_set_save_...

      php session_start()关于Cannot send session cache limiter – headers already sent错误解决方法

      说是已经有输出,用编辑器打,前面明明什么都没有,原来在使用AJAX的 时候,也出现过这种情况,后来,把这个PHP文件放到linux中打开,会发现,在文件的最前面,会出现“锘 ”这样的一个字符(引号内),把它去掉以后...

      用PHP程序实现支持页面后退的两种方法

      总结来说,PHP中支持页面后退的两种主要方法是通过设置`Cache-Control`消息头或者调整`session_cache_limiter()`函数的配置,以确保用户在点击后退按钮时,页面状态能够得到保留。这些技术对于提供更好的用户体验,...

      PHP session_start()问题解疑(详细介绍)

      1. 首先,开发者可能遇到的警告是“Cannot send session cookie - headers already sent”,以及“Cannot send session cache limiter - headers already sent”。这类问题发生的原因是在调用`session_start()`函数...

      PHP7 新特性:use语句、intdiv() 函数、Session 选项.md

      'cache_limiter' =&gt; 'nocache', 'cache_expire' =&gt; 0, ]; session_set_cookie_params(0, '/', '', true, true); session_set_save_handler($options); // 使用自定义选项 session_start(); ?&gt; ``` ## 总结 ...

      php网页后退不再出现过期

       if(function_exists(session_cache_limiter)) { session_cache_limiter(“private, must-revalidate”); } session_start() ?&gt;  您可能感兴趣的文章:php浏览历史记录的方法PHP实现将浏览历史页面网址...

      让PHP支持页面回退的两种方法

      第二,使用session_cache_limiter方法 //注意要写在session_start方法之前 session_cache_limiter(‘private, must-revalidate’);  PS:Cache-Control消息头域说明 Cache-Control指定请求和

    Global site tag (gtag.js) - Google Analytics