396 篇
建站知识总结与分享
搜索“think”
thinkphp中分类获得迭代上级
taotaoit 0 0
2822 0 2018-08-15 ThinkPHP
/** * 迭代获取上级 */ public function getParent($ids = array(),$catId){ $sql = "select catId,catName,parentId from __PREFIX__faq_cats WHERE catId=$catId AND isShow=...
thinkphp中分类获得迭代下级
taotaoit 0 0
2507 0 2018-08-14 ThinkPHP
/** * 迭代获取下级 */ public function getChild($ids = array(),$pids = array()){ $sql = "select catId from __PREFIX__product_cats where catFlag=1 and parentId in(".im...
thinkphp获取数组大小
web 0 1
3552 0 2018-08-14 ThinkPHP
控制器中:echo count($arr)  模板中:{$arr | count} 模板中if判断语句中 <if condition="count($arr)">.....</if>
ThinkPHP中获得一条数据表信息自定义函数public function get()
taotaoit 1 0
3143 0 2018-08-14 ThinkPHP
/* 一般情况 */ public function get(){ return $this->where("id=".(int)I('id'))->find(); } /* 获取信息后拆分多图 */ public function get(){ $m = M('products'); $rs = $m->wh...
Thinkphp图片水印和文字水印
web 0 0
2817 0 2018-07-26 ThinkPHP
1.Thinkphp图像处理 1.1图片处理类和库 首先,在Thinkphp\Think\Image类中有图像处理功能,支持Gd库和Imagick库,包括对GIf图像处理的支持。 1.2实例化类库 $image = new \Think\Image(); 实例化image后,默认使用GD库进行图像操作,如果需要使用Imagick...
thinkphp二级域名配置
web 0 0
2879 0 2018-07-24 ThinkPHP
官方文档 http://document.thinkphp.cn/manual_3_2.html#domian_deploy 以下内容来自网络 首先是在config.php文件中开启二级域名配置 'APP_SUB_DOMAIN_DEPLOY' => true 然后配置二级域名规则如下 'APP_SU...
thinkphp 5 闭包函数的使用详解(传递参数)
web 3 0
3936 0 2018-05-29 ThinkPHP5.1
普通使用 举个栗子: $this->where(function ($query) { $query->where('id', 1)->whereor('id', 2); })->find(); 上述栗子就是一个简单的where查询的闭包函数使用,使用匿名函数添加...
thinkphp5 删除 destroy
web 0 0
3179 0 2017-12-19 ThinkPHP5.1
删除当前模型 删除模型数据,可以在实例化后调用delete方法。 $user = User::get(1); $user->delete(); 根据主键删除 或者直接调用静态方法 User::destroy(1); // 支持批量删除多个数据 User::destroy('1,2,3'); // 或者 User::destro...
thinkphp中怎么过滤html代码?
web 0 0
3352 0 2017-12-06 ThinkPHP
thinkphp模板显示中,怎样去掉内容中的链接? {$val['content']|htmlspecialchars_decode|strip_tags} 这样就可以了 htmlspecialchars_decode() 函数把预定义的 HTML 实体转换为字符。 https://www.w3school.com...
thinkphp5分页paginate()出来的数据怎样循环插入数据?
taotaoit 0 0
3764 0 2017-11-29 ThinkPHP5.1
paginate()出来的数据怎样循环插入数据? paginate()分页如何转数组操作数据之后再转回对象? thinkphp5 model里面用toarray后怎么分页? 以上类似问题的出现,是因为在model模型中使用了->paginate()分页,由于返回的是对象,所以要把数据转换到数组,才能在模...
thinkphp5 分页带参数的解决办法
web 4 0
3156 0 2017-10-26 ThinkPHP5.1
利用tp5默认分页,搜索后点分页,又跑到原来列表了。怎么把搜索关键字传到分页里面呢? $mrs = Db::name('log_operates') ->where($where) ->order('operateId', 'desc') ->paginate(input('pagesiz...
thinkphp5 怎么打印sql语句
web 0 0
4700 0 2017-10-25 ThinkPHP5.1
thinkphp5打印最后一条执行的sql语句 echo db('table')->getlastsql(); db('table')不知道什么意思,不过貌似 db()->getlastsql(); db('123')->getlastsql(); $this->getlastsql(); 这...
thinkPHP5 order多条件排序
taotaoit 12 14
11159 0 2017-10-24 ThinkPHP5.1
总结如下: //单一条件排序 $user = $this->where(['parentId'=>0)->field('userId,userName,userSort,isShow')->order('userSort', 'asc')->select(); //多个条件排序,可以多加一个order...
thinkPHP5 where多条件查询
taotaoit 0 1
3446 0 2017-10-24 ThinkPHP5.1
总结如下: //单一查询条件 $user = $this->where('userId',$userId)->field('secretKey,loginPwd')->find(); //多个查询条件,可以多加一个where $user = $this->where('userId',$userId...
thinkphp5 select对象怎么转数组?
web 3 1
4349 0 2017-10-20 ThinkPHP5.1
toArray() 为什么不行? 方法一: DB操作返回是数组。模型直接操作返回是对象  对象类型转换数组 打开 database.php 增加或修改参数 'resultset_type' => '\think\Collection', 即可连贯操作 model('user')->select()-&...
thinkphp中根据ip获取国家省市
web 0 0
3168 0 2017-09-29 ThinkPHP
引入扩展文件 \extend\iplocation\Location.php Location.php文件内容为: <?php /** .------------------------------------------------------------------- * | Software: [Do...
关于本站

“最难不过坚持”

本人承接扒站仿站,php网站维护,病毒查杀,网站编辑,网站改版,html制作

有需要网站维护,改版,病毒查杀,网站编辑,网站备案,html制作等相关的工作可以联系我。
本人有多年相关工作经验,也可提供免费咨询,交个朋友。
有需要探讨问题的朋友,也可以加我微信,共同探讨!
微信:15011482830 QQ:408917339

8250506 2696 39
最新评论
https://jueru.net/
评 留言
:weixiao:
评 留言
:shuijiao: :weiqu: :zhenbang: :leng:
评 留言
:yiwen: :yiwen: :yiwen: :yiwen:
评 EasySass: could not generate CSS file. See Output panel for details.
这个业务逻辑多少都有点奇怪了,阅读浏览次数增值在新闻详情页的控制器方法里setInc,这怎么还写进模型事件里了。如果非要用onAfterRead也可以,把新闻文章的内容单独分出来一个news_content表,然后把它和news做关联,然后给news_content表的onAfterRead事件做增值处理,这样点进新闻页内查询到文章内容时才会触发它。
评 TP6模型事件-查询后onAfterRead不好用
文章标签更多
ThinkPHP (260)
Mysql (59)
DedeCms (33)
jQuery (74)
证件照 (1)
setInc (4)
setDec (4)
onclick (5)