谁遇到过add()插入成功,但是返回false?大神帮我看看代码
$review = M("review");
if ($review->create()) {
$review->addtime=time();
$review->uid='2';
$review->username='zhangsan';
$review->vid=$_POST['vid']; //(这里如果不加上也添加不进去)
$review->content=$_POST['content'];//(这里如果不加上也添加不进去)
if ($id = $review->add()) {//(这里返回的$id是false,但是已经插入成功)
$vo = $review->where("vid=1")->field('username','content','addtime')->order('id desc')->find($id);
$this->ajaxReturn($vo, 'ok', 1);
} else {
$this->error($review->getError());
}
} else {
$this->error($review->getError());
//,使用下面的方法也一样的效果(add()插入成功,返回false)
$data['addtime']=time();
$data['uid']='2';
$data['username']='zhangsan';
$data['vid']=$_POST['vid'];
$data['content']=$_POST['content'];
$id = $review->add($data);
dump($id);exit;
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft