CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  PHP

页首加入验证文件后,go(-1)出现问题

楼主bonson(bonson)2003-09-04 02:12:43 在 Web 开发 / PHP 提问

在页首回入  
  <?   include   (../verify.php)   ?>  
   
  ...  
  <form   METHOD="POST"   ACTION="addmsg.php">  
  ..  
  </form>  
   
   
  在addmsg.php中  
  输入有错时   document.location="javascript:history.go(-1)";  
   
  但是,当返回上个页面时,表单里原来输入的数据全没了!这是为什么呢?如何解决?请赐教!  
  PS.我如果把<?   include   (../verify.php)   ?>   不要掉,返回时就正常了 问题点数:20、回复次数:8Top

1 楼tvhero(改学VB中...)回复于 2003-09-04 05:33:24 得分 0

因为你验证的时候把数据给提交了。你不用go(-1),改用response.redirect(XXX.asp?data=thedata),这样就可以在提交时先把数据保存下来,redirect时再把数据写回去。因为我原来用的是asp,所以不能给你php代码,反正大概方法是这样的。我原来就是这么做的。Top

2 楼xuzuning(唠叨)回复于 2003-09-04 09:31:43 得分 15

因为verify.php中起用了session  
  你可在verify.php中加入session_cache_limiter('private');或session_cache_limiter('public');  
  如:  
  <?php  
  session_cache_limiter('private');  
  session_start();  
  ...  
  Top

3 楼bonniewater(陪你去看海)回复于 2003-09-04 09:32:30 得分 0

你帮你的表单的值用session保存起来吧Top

4 楼bonson(bonson)回复于 2003-09-04 12:10:47 得分 0

非常感谢     xuzuning(唠叨)    
  问题已得到解决!  
  但你能否跟我说说设成private模式跟设成public模式具体有什么区别吧?  
  在我问的这个问题上,设成哪种模式都行,但我想知道在其他方面,这两者有什么区别吗?Top

5 楼DFlyingchen(弱水三千)回复于 2003-09-04 12:30:07 得分 5

session_cache_limiter  
  (PHP   4   >=   4.0.3)  
   
  session_cache_limiter   --   Get   and/or   set   the   current   cache   limiter  
  Description  
  string   session_cache_limiter   (   [string   cache_limiter])  
   
   
  session_cache_limiter()   returns   the   name   of   the   current   cache   limiter.   If   cache_limiter   is   specified,   the   name   of   the   current   cache   limiter   is   changed   to   the   new   value.    
   
  The   cache   limiter   defines   which   cache   control   HTTP   headers   are   sent   to   the   client.   These   headers   determine   the   rules   by   which   the   page   content   may   be   cached   by   the   client   and   intermediate   proxies.   Setting   the   cache   limiter   to   nocache   disallows   any   client/proxy   caching.   A   value   of   public   permits   caching   by   proxies   and   the   client,   whereas   private   disallows   caching   by   proxies   and   permits   the   client   to   cache   the   contents.    
   
  In   private   mode,   the   Expire   header   sent   to   the   client   may   cause   confusion   for   some   browsers,   including   Mozilla.   You   can   avoid   this   problem   by   using   private_no_expire   mode.   The   expire   header   is   never   sent   to   the   client   in   this   mode.    
   
  注:   private_no_expire   was   added   in   PHP   4.2.0.    
   
  The   cache   limiter   is   reset   to   the   default   value   stored   in   session.cache_limiter   at   request   startup   time.   Thus,   you   need   to   call   session_cache_limiter()   for   every   request   (and   before   session_start()   is   called).    
   
  例子   1.   session_cache_limiter()   example  
   
  <?php  
   
  /*   set   the   cache   limiter   to   'private'   */  
   
  session_cache_limiter('private');  
  $cache_limiter   =   session_cache_limiter();  
   
  echo   "The   cache   limiter   is   now   set   to   $cache_limiter<p>";  
  ?>  
     
     
  Top

6 楼bonson(bonson)回复于 2003-09-04 12:58:27 得分 0

不好意思,又有问题了  
  在verify.php中加了session_cache_limiter('private')后  
  所有包含verify.php的页面返回本页时全都不会刷新!  
  如:在一个添加页面,我添加了某一信息,重返回添加页面,显示的还是旧的页面  
  要手动刷新才能反映数据库的最新情况Top

7 楼nullfox(我把青春毁给你)回复于 2003-09-04 13:00:07 得分 0

及时雨。我也遇到了这样的问题,真谢谢各位。Top

8 楼bonson(bonson)回复于 2003-09-04 13:20:26 得分 0

我现在的解决方法是  
  在verify.php中不加入session_cache_limiter('private')  
  在需要设置session_cache_limiter('private')的页面再加上  
  问题都能解决了!  
  但我仍期待着高手提出更好的解决方法Top

相关问题

  • 关于文件上传的验证
  • 关于文件验证的问题!急
  • 下载的linxu如何使用md5文件进行验证?
  • 如何验证文件名的合法性?
  • 帮忙!静态文件的想验证权限
  • 帮忙!静态文件的想验证权限
  • ascx文件的Forms身份验证问题
  • java读取xml,关于其中dtd文件验证的问题
  • idtcpclient发送文件,身份验证问题
  • 如何验证文件名是否合法?

关键词

  • 页面
  • 数据
  • 解决
  • php
  • verify
  • 加入
  • 添加
  • limiter
  • 返回
  • 问题

得分解答快速导航

  • 帖主:bonson
  • xuzuning
  • DFlyingchen

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo