置顶
【原创】 微信小程序获取数据
15 09 2019
  getly: function () {
    wx.request({
      url: 'https://yxy.xxm9.top/index/index/message',
      success: (res) => {
        this.setData({
          getly: res.data.data
         
        })
      }
    })
  },
置顶
【原创】 thinkphp5
12 09 2019
    public function adduser()
    {
        $param = $this->request->param();
        if ($this->request->isPost()) {
            $adduser = Db::name("user")->insert([
                'user_nickname'                 => $param['username'],
                'avatar'                 => $param['avatar'],
                'user_email'                 => $param['email'],
                'mobile'                 => $param['phone'],
                'create_time'           => time(),
               // 'sex'                 => $param['sex'],
                'status'                => 1
              
            ]);
            if ($adduser) {
                $this->success('添加成功!');
                
            } else {
                $this->error('添加失败!');
            }
        } else {
            return $this->fetch();
        }
    }

    public function edituser()
    {
        $param = $this->request->param();
        if ($this->request->isPost()) {
            $id = $param['id'];
            $update_return = Db::name("notice")
                    ->where('id', $id)
                    ->update([
                        'title'                 => $param['title'],
                        'content'               => $param['content']
                    ]);
            if (!$update_return) {
                $this->error('修改失败!');
            } else {
                $this->success('修改成功!');
            }
        } else {
            $id = $param['id'];

            $user_find = Db::name('user')->where(['id'=>$id])->find();

            $this->assign('user_find',$user_find);
            return $this->fetch();
        }
    }
    
    public function deluser()
    {
        if ($this->request->isPost()) {
            $param = $this->request->param();
            $id = $param['id'];
            //dump($id);die;
            $deluser = Db::name("user")->delete($id);
            if ($deluser) {
                $this->success('删除成功!');               
            } else {
                $this->error('删除失败!');
            }
        }
    }
置顶
【原创】 网易云音乐mp3外链、真实地址下载方法
06 09 2019
一个网易音乐外链地址长期有效,很简单的方法:

第一步打开网易云音乐,随便找到一首歌,播放,复制网址的ID,

例如:杨钰莹的心雨,网址是:

http://music.163.com/#/song?id=317151

很明显,ID是317151

那么,这首歌的真实地址就是:

http://music.163.com/song/media/outer/url?id=317151.mp3

这个地址不会失效的;

这就得到一个下载公式:

http://music.163.com/song/media/outer/url?id=ID数字.mp3

把上面红色部分ID数字换成网易云播放页面的id即可。

 

实例:


潘美辰:我曾用心爱着你

http://music.163.com/#/song?id=281951

mp3下载、外链地址:

http://music.163.com/song/media/outer/url?id=281951.mp3
置顶
【原创】 uni-app单图片上传
19 08 2019
_self = this;
uni.chooseImage({
	count: 1,
	sizeType: ['original', 'compressed'],
	sourceType: ['album'],
	success: function (res) {
		 const tempFilePaths = res.tempFilePaths;
			const uploadTask = uni.uploadFile({
			 url : _self.apiServer+'/wap/index/webupload',
			 filePath: tempFilePaths[0],
			 name: 'file',
			 formData: {
			  'user': 'test'
			 },
			 success: function (uploadFileRes) {
			  // console.log(uploadFileRes.data);
			  _self.photo=_self.apiServer+uploadFileRes.data;
			  console.log(_self.photo);
			 }
			});
	}
});
置顶
【原创】 php接收文件上传
19 08 2019
public function webupload(){
    if(!empty($_FILES['file'])){
        //获取扩展名
        $exename  = $this->getExeName($_FILES['file']['name']);
        if($exename != 'png' && $exename != 'jpg' && $exename != 'gif'){
            exit('不允许的扩展名');
        }
        $imageSavePath = uniqid().'.'.$exename;
        if(move_uploaded_file($_FILES['file']['tmp_name'], $imageSavePath)){
            echo $imageSavePath;
        }
    }
}

public function getExeName($fileName){
    $pathinfo      = pathinfo($fileName);
    return strtolower($pathinfo['extension']);
}
}

1234567
  • 35条记录 第1页/共7