使用thinkphp时因为一个’/‘造成页面一直跳转

29 篇文章 0 订阅
5 篇文章 0 订阅
form表单如下,
<form action="http://localhost/think/zpf_think/xiangmu/index.php/User/modify/" method="post">


<input type="hidden" name="id" value="<{$data.id}>">id<br />
<input type="text" name="username" value="<{$data.username}>">用户名<br />

性别:男<input type='radio' name='sex' value='1' />
	 女<input type='radio' name='sex' value='0' /><br/>
<input type="submit" value="提交修改">


</form>
</pre><pre name="code" class="html">模型如下:
<pre name="code" class="php">	public function modify(){
			$m=M('User');
			$data['id']=$_POST['id'];
			$data['username']=$_POST['username'];
			$data['sex']=$_POST['sex'];
			$count=$m->save($data);
			if($count>0){
				
				$this->success('数据修改成功','index');

			}else{
				
				$this->error('数据修改失败');
			}
		}
	}
</pre><pre name="code" class="php">发现页面一直在数据修改成功和数据修改失败两个页面跳转,跟着视频学着,发现由于form表单中的action中多了一个'/'造成的,
所以把form表单中的action路径改为<pre name="code" class="html"><form action="http://localhost/think/zpf_think/xiangmu/index.php/User/modify" method="post">
就可以了
</pre><pre>
 

                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值