wangeditor cannot pass value to backend
P粉021180371
P粉021180371 2022-11-19 23:33:09
0
1
784

Hello, teacher, I use the tp6 framework to introduce wangeditor, but I cannot pass the value of the editing content to the backend. Can you help analyze it?

html:

< ;div class="col-sm-10">

##js code

function save(){ var data = new Object; data.content = editor.getHtml(); // if (content =='') {} $.post('/index.php/admin/article/artadd',data,function(res){ },'json'); alert(data.content); }

Backend code

public function artadd(){ //Add a judgment so that the two are not executed at the same time if (Request::isPost()) { $title = input('post.title'); $cid = input('post.cid'); $time = time(); $content = htmlspecialchars(input('post.content')); )); $status = input('post.status'); $hot = input('post.hot'); $himg = input('post.himg'); $cimg = input('post.cimg') ; $picurl = input('post.picurl'); $file)){ $savename = \think\facade\Filesystem::putFile( 'topic', $file); // }else{ echo json_encode(['code'=>0,'msg'=> ;'Unable to upload image']); ' =>$content, ' 'hot' => $hot, ' 'himg' => $himg, 'cimg' => $cimg, ' 'picurl' => $savename, ' 'status'=>$ status, 'time' =>$time
P粉021180371
P粉021180371

reply all (1)
autoload

Look at the request in the network

    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!