- 请问为什么已上传图片就报错呢??
我获取了小程序的name:‘file’; 已上传就报非法上传文件???求解??? $fileinfo=$_FILES['file']; // dump($fileinfo); $upload = new \Think\Upload();// 实例化上传类 $upload->maxSize = 3145728 ;// 设置附件上传大小 $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型 $upload->rootPath = './public/images/'; // 设置附件上传根目录 // 上传单个文件 $info = $upload->uploadOne($fileinfo); if(!$info) {// 上传错误提示错误信息 $this->error($upload->getError()); }else{// 上传成功 获取上传文件信息 echo $info['savepath'].$info['savename']; } echo json_encode($info);
2017-07-27 - 请问怎么在后台获取图片呢???求代码???
//获取多张图片 chooseImage: function () { var that = this; var res_url = app.globalData.res_url; wx.chooseImage({ count: 4, // 最多可以选择的图片张数,默认9 sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有 sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有 count: this.data.count[this.data.countIndex], success: function (res) { var tempFilePaths = res.tempFilePaths; // console.log(tempFilePaths) //console.log(res) // console.log('xxxxxx') that.setData({ imageList: res.tempFilePaths, }) wx.uploadFile({ url: res_url + 'index.php?g=admin&m=wxxcx&a=release', method: "POST", header: { "Content-Type": "application/x-www-form-urlencoded", }, filePath: tempFilePaths[0], name: 'file', formData: { 'user': 'test' }, success: function (res) { var data = tempFilePaths[0] // console.log(data) that.setData({ data: tempFilePaths[0], }) //do something } }), } }) }, 这是我的代码??不知道怎么在后台获取图片??求解
2017-07-27 - 请问怎么把表单里的数据传到后台???求代码???
[图片] 我的代码。。可是获取不到表单里的内容 [图片] 求解!!!!!!
2017-07-26 - 请问怎么把data里的数据传到后台呀?一直报错。。。。
var app = getApp(); Page({ /** * 页面的初始数据 */ data: { src: "", imageList: [], countIndex: 3,//最多上传图片的数量 count: [1, 2, 3, 4, 5, 6, 7, 8, 9], tip:'', user: '', p: '', title: '', content: '', }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { //接口调用示例 var that = this //获取请求地址的url var res_url = app.globalData.res_url; //发起请求 wx.request({ //接口地址 url: res_url + 'index.php?g=admin&m=wxxcx&a=release', method: 'POST', //请求数据 data: { id: '1', name: 'ceshi', }, header: { "Content-Type": "application/x-www-form-urlencoded" }, //成功后回调 success: function (res) { console.log(res.data) that.setData({ result: res.data }) } }) }, navbarTap: function (e) { this.setData({ currentTab: e.currentTarget.dataset.idx }) } }) 这是js里的数据;我想把data里的 user: '', p: '', title: '', content: '',这几个数据传到后台。。。。请问代码怎么写呢????
2017-07-26 - 为什么一直报 res_url未定义?
[图片] ???? [图片] 我有定义的 ?????
2017-07-26 - 为什么微信开发文档里的搜索不能用???
为什么微信开发文档里的搜索不能用???换浏览器也不行。。求解??
2017-07-25 - 获取微信的名字,昨天还能出来,今天就出不来了,数据库的数据也不出来了?
<view class="name"> <view class="one">{{user}}:</view> <view class="twe">{{userInfo.nickName}}</view> <view class="clear"></view> </view> <view class="name"> <view class="one">{{product}}:</view> <view class="twe">{{arr[0]['title']}}</view> <view class="clear"></view> </view> js里的: data: { button:"申请", arr: [], userInfo: [], tip: '', buttonDisabled: false, modalHidden: true, show: false }, onLoad: function (options) { var that = this//不要漏了这句,很重要 //调用应用实例的方法获取全局数据 app.getUserInfo(function (userInfo) { //更新数据 that.setData({ userInfo: userInfo }) }) //获取跳转参数 this.setData({ text: options.id }) } 这是我的代码,没改过,出不来了。。。。
2017-07-24 - 我想把服务器上的图片显示在页面,路径一直报错
我想把图片显示在页面,路径一直报错,找不到,怎么改都不行,域名没问题, 域名/taste/public/images/2017-7-11/59644d11ad548.png 求解????
2017-07-23 - 不用表单能把数据添加进数据库吗?
我想做添加,数据都是获取到的,不能更改,不用表单能添加吗?怎么添加呢?网上没有找到的说
2017-07-22 - 为甚吗js文件不能引入?
为甚吗js文件不能引入?我想在首页引入同一个文件夹下的js文件,为什么老报错? [图片]
2017-07-21