thinkphp插入数据。很神奇的问题。

WBOY
Release: 2016-06-23 13:50:04
Original
1058 people have browsed it

做程序这么久了。第一次遇到这种问题。很无语。。。也很无解。。

test.php?a=index&ac=adduser&uid=399
这个地址用的是THINKPHP。代码大概如下:
     $LinkUser = D('LinkUser');
     $data = array();
     $data['nickname'] = ‘test’;
     $newid = $LinkUser->add($data);
可以正常添加,但数据会重复,再次执行 就不会重复。

若参数变为400
test.php?a=index&ac=adduser&uid=400的时候,执行插入。发现还是重复2条。

只要地址栏参数值变更。就会重复插入。不变更 则正常。甚是不解。。。

再次求助。谢谢好心人


回复讨论(解决方案)

这个链接有前台吗,是不是前台请求了同样的url,再次刷新时因为缓存问题只有一个url访问了所以看上去正常?
你的LinkUserModel中的add方法有没有重定义偷偷接收uid?

前台地址:
http://www.dooraa.com/test.php?a=index&uid=1
直接点添加。然后再原有的连接上再点。就不会重复。再新的连接上点。会重复。再点就不会重复。

LinkUserModel 这个类 其实是空的。。

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!