AslroNx's World

tp练习

2017-8-8 aslronx

<?php
namespace app\index\Controller;


use think\Controller;

class Index extends Controller
{
    public
    function index()
    {
        //分页
//        $user = D('img');
//        $c = $user->count();
//        $arr = $user->select();//获得关联表的数据
//        $page = new Page($c, 1);
//        $page->setConfig('first', '首页');
//        $page->setConfig('prev', '上一页');
//        $page->setConfig('next', '下一页');
//        $page->setConfig('last', '末页');
//        $show = $page->show();
//        $list = $user->limit($page->firstRow, $page->listRows)->select();
//        $this->assign('list', $list);
//        $this->assign('page', $show);
//        $this->display();
//        var_dump($c);
//        $user = M('user');
//        $arr = $user->where(' id=5')->select();
//        $this->assign('user', $arr[0]);
//        $this->display();
        return $this->fetch();
    }

    public
    function upload()
    {
        $upload = new Upload();
        $upload->maxSize = 534631;
        $upload->exts = array('gif', 'jpg', 'png', 'jpeg');
        $upload->savePath = './';
        $info = $upload->upload();
        var_dump($info);
        if (!$info) {
            $this->error($upload->getError());
        } else {
            $this->success('成功');
        }
    }

    public
    function index2()
    {
        $this->display();
    }

    public
    function index3()
    {
        $this->display();
    }

    public
    function index4()
    {
        $this->display();
    }

    public
    function test()
    {
        //静态验证
//        $user = D('user');
//        $d['username'] = '你大爷45645';
//        $d['email']="";
//        if ($user->create($d)) {
//            echo "成功";
//        } else {
//            var_dump($user->getError());
//        };
        //动态验证
//        $rules = array(
//            array('username', 'require', '不能为空'),
//            );
//        $user = M('user');
//        $d['username'] = '';
//        if ($user->validate($rules)->create($d)) {
//            echo "成功";
//        } else {
//            var_dump($user->getError());
//        };

//        var_dump($user->where(' sex="男"')->select());
//        var_dump($user->where($c)->select());
//        var_dump($user->order('id desc')->select());//指定排序方式
//        var_dump($user->field('username')->select());//只返回指定数据
//        var_dump($user->limit(3,2)->select());//分页
//        var_dump($user->table('mess')->select());//换表
//        var_dump($user->alias('a')->select());//设置表别名a
//        var_dump($user->group('id')->select());//分组
//        var_dump($user->comment('id')->select());//不清楚
//        var_dump($user->join('id')->select());//不清楚
//        var_dump($user->union('id')->select());//不清楚
//        var_dump($user->distinct('id')->select());//不清楚
//        var_dump($user->cache('id')->select());//缓存
//        var_dump($user->create());//类似post方法,但只获取数据表中存在的项
//        var_dump($user->create($_POST));//获取post数据
//        $_POST['password']=md5($_POST['password']);
//        $user->add($_POST);//向数据表插入数据
//        var_dump($user->find());//查询一条数据
//        var_dump($user->getField("username",true));//查询指定数据
//        $d['username']='sdfsg';//
//        $user->where('id=1')->save($d);//修改数据
//        $user->where('id=1')->setField("username", '哈哈哈哈哈');//修改指定数据
//        $user->where('id=1')->setInc("st", 1);//修改指定数据
//        $user->where('id=1')->setDec("st", 1);//修改指定数据
//        $user->delete(1);//删除id为1的数据
//        $user->delete(3,4);删除多个的数据
//        $a['username']='admin';
//        $user->where($a)->delete();//删除
    }
}

评论(0) 浏览(470)

微信小程序开发文档_w3cschool

2017-8-7 aslronx

原文:https://www.w3cschool.cn/weixinapp/

评论(0) 浏览(590)

微信小程序开发的那些坑,你踩过吗?_微信小程序开发_新浪博客

2017-8-3 aslronx

原文:http://blog.sina.com.cn/s/blog_17250c5360102wysf.html

评论(0) 浏览(604)

微信小程序接入指南 · 小程序

2017-7-30 aslronx

原文:https://mp.weixin.qq.com/debug/wxadoc/introduction/#填写主体信息并选择验证方式

评论(0) 浏览(616)

微信公众号管理员怎么修改呢?_搜狐科技_搜狐网

2017-7-23 aslronx

原文:http://www.sohu.com/a/192718170_99976793

评论(0) 浏览(586)

教程 · 小游戏

2017-7-19 aslronx

原文:https://mp.weixin.qq.com/debug/wxagame/dev/index.html?t=2018115

评论(0) 浏览(584)

GenSignature - fir.im

2017-7-15 aslronx

原文:https://fir.im/ep1b

评论(0) 浏览(552)

用js屏蔽脚本加载的广告 - CSDN博客

2017-7-11 aslronx

原文:http://blog.csdn.net/u013172064/article/details/66971257

评论(0) 浏览(598)

dedecms mysql

2017-7-8 aslronx

http://www.w3school.com.cn/sql/

SELECT * FROM dede_arctype WHERE id=2;
SELECT * FROM dede_arctype WHERE typeid=77;
select  *from dede_sysconfig where varname=cfg_link;

UPDATE dede_arctype SET id = 2 WHERE id = 77;
UPDATE dede_addonarticle SET id = 2 WHERE id = 77;

DELETE FROM table_name WHERE column_name = some_value;
DELETE FROM sysconfig WHERE column_name = some_value;
DELETE FROM sysconfig WHERE varname= 'swt_link';

☆☆☆☆☆★★★★★


文章批量移动
UPDATE dede_addonarticle SET typeid = 9 WHERE typeid = 40;
UPDATE dede_archives SET typeid = 9 WHERE typeid = 40;
UPDATE dede_arctiny SET typeid = 9 WHERE typeid = 40;

UPDATE dede_arctype SET reid = 8 WHERE reid = 9;

评论(0) 浏览(520)