ajax 提交时404错误---ThinkCMFX2.23


public function form_post(){
        
        $file=$_FILES['thumb'];
        
        // 实例化上传类
        $upload = new \Think\Upload();
        // 设置附件上传大小
        $upload->maxSize = 2 * 1024 * 1024;
        // 设置附件上传根目录
        $upload->rootPath = './';
        // 设置附件上传(子)目录
        $upload->savePath = 'data/upload/portal/';
        $info = $upload->uploadOne($file);
        $fileinfo=explode('/', $info['savepath']);
        $smeta['thumb']='portal/'.$fileinfo['3'].'/'.$info['savename'];
        
        $termid=I('termid');
        
        $article['post_date']=date('Y-m-d H:i:s',time());
        $article['post_title']=I('title');
        $article['post_excerpt']=I('excerpt');
        $article['post_keyword']=I('keyword');
        $article['post_content']=I('content');
        $article['smeta']=json_encode($smeta);
        $article['post_status']=0;
        $article['post_author']=1;
        $result=M('posts')->add($article);
        $result=M('term_relationships')->add(array("term_id"=>intval($termid),"object_id"=>$result));
        if($result){
            $this->ajaxReturn(array('msg'=>'提交成功'));
        }else{
            $this->ajaxReturn(array('msg'=>'提交失败'));
        }
    }

http://company.iyoutui.cn/index.php?g=index&m=index&a=develop&termid=1


我本地windows测试可以的

但是放到服务器上就不行了(nginx+liunx

打赏

评论

暂时关闭,稍后恢复~
文档请看10遍以上!有问题可加QQ群!
发表话题

源素材推荐

提问必知

0.话题发布后没及时显示,请联系官方QQ群管理;
1.话题支持代码,qq截屏直接粘贴,和QQ群一样;
2.问题描述清,比如服务器版本,程序版本;
3.能上代码,就不用文字;
4.把问题发到话题后再发QQ群;
5.如果感觉回复者解答的不错,可以发红包!
6.多帮助别人也是对自己的锻炼!
7.付费讨论中只有提问者和付费用户才可以查看回复

积分规则

1.评论积分+1;每天最多10次奖励
2.发布话题积分+1;每天最多5次奖励
3.垃圾评论积分-500;
4.黄色,暴力,违反我国法律评论直接封号


ThinkCMF 8.0.0发布啦!祝大家节日快乐! 立即体验!