猫小怪

世人慌慌张张,不过图碎银几两。

 

写项目时整理的小笔记(3)

1. 页面刷新

  window.location.reload();//页面刷新

2. 跨控制器引用该控制器的一个方法方法(thinkphp3)

  $weixin = A("Wxapi/Weixin");

 

  $signPackage = $weixin -> getSignPackage();

  

3. 去除input选中框   outline:none

4.$address_info = M('user_address')->where("user_id='$user_id'")->find();->(查询一条数据,不循环输出)

 $jifen = M('mingxi')->where("user_id='$user_id'")->order('id desc')->select();->(查询全部,适用循环输出)

5. redirect方法的引用

  

 

 

 6. 方法与页面名重复时如何处理

  

 

 

   

 

 

 7.页面内判断状态

  

 

 

 8. js实现自动执行

  <script>
    function makeCounter() {
        // 只能在makeCounter内部访问i
        var i = 0;
        var id =$('#id').val();
        return function () {
            jQuery.ajax({
                type: "post",
                url: "{:U('Index/more')}",
                dataType: "json",
                data:{'id':id},
            })
        };
    }
    var counter = makeCounter();
    counter(); // logs: 1
    alert(1);
</script>

9. tp3后台连接数组中字符串

 

 

 

 10. 分页

  css

    <style>
    .pages{
        width: 100%;
        text-align: center;
    }
    .pages a,.pages span {
        display:inline-block;
        padding:2px 5px;
        margin:0 1px;
        border:1px solid #f0f0f0;
        -webkit-border-radius:3px;
        -moz-border-radius:3px;
        border-radius:3px;
    }
    .pages a,.pages li {
        display:inline-block;
        list-style: none;
        text-decoration:none; color:#58A0D3;
    }
    .pages a.first,.pages a.prev,.pages a.next,.pages a.end{
        margin:0;
    }
    .pages a:hover{
        border-color:#50A8E6;
    }
    .pages span.current{
        background:#50A8E6;
        color:#FFF;
        font-weight:700;
        border-color:#50A8E6;
    }
  </style>

  html

    <div class="pages">
        {$page}
    </div>

  PHP

    function more(){
        $n = M('news');
        $count =  $n->where("sortid='126'")->count();
        $p = getpage($count,6);
        $category = $n->where("sortid='126'")->limit($p->firstRow, $p->listRows)->select();
        $this->assign('page', $p->show());
        $this->assign('rs',$category);
       $this->display();
    }

11. JSON.stringify(转化obj)

12. appendTo()添加元素每点击一次会添加一次

13. $(‘#new’).html(html)->只添加一次

14.

 

15. Jq修改css样式

  $("#aaa .industry:nth-child("+id+")").attr('style','background:#1E90FF').siblings().attr('style','background:#fff');
  $("#bbb .case-panel:nth-child("+id+")").addClass("active");

 

 

 

posted on 2020-06-08 21:13  猫小怪  阅读(46)  评论(0编辑  收藏  举报

导航