58 篇
建站知识总结与分享
搜索“查询”
tp5.1多字段相同查询条件sql语句怎么写
web 4 1
3589 0 2019-09-26 ThinkPHP5.1
快捷查询方式是一种多字段相同查询条件的简化写法,可以进一步简化查询条件的写法,在多个字段之间 用|分割表示OR查询,用&分割表示AND查询, 可以实现下面的查询,例如: Db::table('think_user') ->where('name|title','like','thinkphp%')...
tp5.1组合条件查询出错
taotaoit 0 0
2425 0 2019-07-02 ThinkPHP5.1
tp5.1组合条件查询出错 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ve...
sql语句字段名如何加特定字符达到精准查询
web 0 0
3232 0 2019-04-23 SQL
我们在做sql查询时,有时要完全匹配,要求我们在数据库字段名前后加上特定的字符,以供精确查询。 比如数据库中关键字存储的是"a,ab,abc"类似信息,当搜索"a"的时候,我只想要关键字包含"a"的信息,不需要包含"ab"或"abc"的信息,怎么实现呢? select * from table where keywor...
PHP parse_str() 函数把查询字符串解析到变量中
web 0 0
2076 0 2019-04-18 PHP
parse_str() 函数把查询字符串解析到变量中。 注释:如果未设置 array 参数,则由该函数设置的变量将覆盖已存在的同名变量。 注释:php.ini 文件中的 magic_quotes_gpc 设置影响该函数的输出。如果已启用,那么在 parse_str() 解析之前,变量会被 addslashes() 转换。 语法 ...
tp5.1根据条件判断是否进行多表联合查询怎么写
taotaoit 4 5
4605 0 2019-01-25 ThinkPHP5.1
<?php $where[] = ['u.dataFlag','=',1]; if($userName!='')$where[] = ['u.userName','like','%'.$userName.'%']; if($catId>0)$where[] = ['uc.catId','=',$catId]; $total =...
thinkphp5.1模型查询
web 0 0
2461 0 2019-01-15 ThinkPHP5.1
<?php namespace app\index\model; use think\Model; use think\Db; class User extends Model { protected $pk = 'id'; /** * 查询-模型查询和数据库查询方法的区别主要在于,模型中的查询的数据在获取的时候会经过获取...
thinkphp5.1原生查询
web 0 0
1954 0 2019-01-11 ThinkPHP5.1
<?php namespace app\index\model; use think\Model; use think\Db; class Articles extends Model { /** * 原生查询 */ public function indexFun(){ // query方法 // query...
thinkphp5.1子查询
web 0 1
2636 0 2019-01-11 ThinkPHP5.1
<?php namespace app\index\model; use think\Model; use think\Db; class Articles extends Model { /** * 子查询 */ public function indexFun(){ // 构造子查询SQL-使用fetchSql...
thinkphp5.1视图查询
web 0 0
2059 0 2019-01-11 ThinkPHP5.1
<?php namespace app\index\model; use think\Model; use think\Db; use think\db\Where; class Articles extends Model { /** * 视图查询 */ public function indexFun(){ //...
thinkphp5.1高级查询
web 0 0
2824 0 2019-01-11 ThinkPHP5.1
<?php namespace app\index\model; use think\Model; use think\Db; use think\db\Where; class Articles extends Model { /** * 高级查询-快捷查询方式是一种多字段相同查询条件的简化写法,可以进一步简化查询条件的写法...
thinkphp5.1时间查询
web 1 0
2685 0 2019-01-11 ThinkPHP5.1
<?php namespace app\index\model; use think\Model; use think\Db; class Articles extends Model { /** * 时间查询 */ public function indexFun(){ // 使用where方法-大于某个时间 ...
thinkphp5.1聚合查询
web 0 0
1952 0 2019-01-10 ThinkPHP5.1
<?php namespace app\index\model; use think\Model; use think\Db; class Articles extends Model { /** * 聚合查询 * 聚合方法如果没有数据,默认都是0,聚合查询都可以配合其它查询条件 */ public funct...
thinkphp5.1链式操作table
web 0 0
1823 0 2019-01-09 ThinkPHP5.1
<?php namespace app\index\model; use think\Model; use think\Db; class Articles extends Model { /** * 链式操作-table */ public function table(){ // table方法主要用于指定操作的...
thinkphp5.1查询表达式
web 0 0
2724 0 2019-01-08 ThinkPHP5.1
查询表达式 查询表达式支持大部分的SQL查询语法,也是ThinkPHP查询语言的精髓,查询表达式的使用格式: where('字段名','表达式','查询条件'); whereOr('字段名','表达式','查询条件'); 5.1还支持新的查询方法 whereField('表达式','查询条件'); whereOrField('表达式'...
thinkphp5.1查询数据
web 2 0
2508 0 2019-01-07 ThinkPHP5.1
<?php namespace app\index\model; use think\Db; class Articles { /** * 查询单个数据-find 方法查询结果不存在,返回 null,否则返回结果数组 */ public function find(){ // table方法必须指定完整的数据表名,...
thinkphp5.0和thinkphp5.1关于where条件的区别
web 2 1
3188 0 2018-11-21 ThinkPHP5.1
关于where的使用官方手册 5.0   https://www.kancloud.cn/manual/thinkphp5/118073 5.1   https://www.kancloud.cn/manual/thinkphp5_1/354006 如果需要事先组装数组...
关于本站

“最难不过坚持”

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

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

6614012 2622 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 (254)
Mysql (58)
DedeCms (33)
jQuery (67)
证件照 (1)
setInc (4)
setDec (4)
onclick (5)