• ThinkPHP5杂技(二)


    不要使用数据库查询嵌套

            if (!$listA = Db::name('coin')
                ->field('id,symbol')
                ->where('id', 'IN', logic('Alliance/Alliance')->getSet($this->site['id'], 'coin'))
                ->order('id asc')
                ->select()) {
                $this->error('没有可用币种');
            }

    logic Alliance中包含数据查询,导致内部采用了field('id, symbol')条件

    TP5分页默认是get方式做跳转

    想要实现ajax样式,通过事先绑定click事件,然后移除href属性。

    $(document).ready(function () {
      $(".pagination > li > a").each(function () {
        $(this).click(function () {
          var href = $(this).attr('href');
          $(this).removeAttr('href');
          $.ajax({
            type: "GET",
            url: href,
            dataType: "html",
            success: function (data) {
              $(".inbox-body").html(data);
            }
          })
        });
      });
  • 相关阅读:
    Mysql
    Java-多线程
    Java-Spring事务
    上传图片的工具类
    Githup随笔
    JsonArray
    Ajax
    maven的三大生命周期
    Apache与Tomcat
    java json字符串转JSONObject和JSONArray以及取值的实例
  • 原文地址:https://www.cnblogs.com/8000cabbage/p/7895092.html
Copyright © 2020-2023  润新知