881 篇
建站知识总结与分享
搜索“php”
php生成唯一识别码uuid
web 0 0
1672 0 2022-07-18 PHP
/*生成唯一标志*标准的UUID格式为:xxxxxxxx-xxxx-xxxx-xxxxxx-xxxxxxxxxx(8-4-4-4-12)*/function uuid() { $chars = md5(uniqid(mt_rand(), true)); $uuid = substr ( $chars, 0, ...
PHP array_unshift():在数组开头插入元素
web 0 0
1374 0 2022-06-30 PHP
PHP array_unshift() 函数用来在数组开头插入一个或多个元素,其语法如下: int array_unshift ( array &$arr , mixed $value1 [, mixed $value2, mixed $value3 ... ] ) 参数说明: arr 表示一个数组; value1, value...
wordpress图片路径<?php bloginfo('template_url'); ?>/images/1.jpg
taotaoit 1 0
1677 0 2022-06-23 Wordpress
wordpress图片路径<?php bloginfo('template_url'); ?>/images/1.jpg
TP6模型事件-查询后onAfterRead不好用
taotaoit 15 0
6941 2 2022-06-15 ThinkPHP6
TP6模型事件-查询后onAfterRead不好用 比如,我想实现浏览新闻后,浏览次数加1 实现: public static function onAfterRead($news) { $news->read_number += 1; $news->save(); } 运行后,浏览次数加1了,很好,对不对...
TP6的cookie助手函数第二个参数一定要字符串
web 1 0
2134 0 2022-06-15 ThinkPHP6
TP6中cookie助手函数的第二参数一定要是字符串,否则会报错? cookie("history_goods",$history,25920000); 我这里的$history是数组 Argument 2 passed to think\Cookie::set() must be of the type string, array ...
thinkphp6怎么实现MySql中的concat方法
taotaoit 0 0
2547 0 2022-06-13 ThinkPHP6
thinkphp6怎么实现MySql中的concat方法? $where[] = [Db::raw('CONCAT(areaid,',')'), 'LIKE', $areaid.',%']; 实际应用: $where = []; $where[] = ['delete_time', 'null','']; ...
thinkphp6 数据库查询Db::name('user')->select()查询结果是对象而不是数组
web 0 0
2320 0 2022-06-01 ThinkPHP6
thinkphp6 数据库查询Db::name('user')->select()查询结果是对象而不是数组 Db::table('think_user')->where('status', 1)->select(); select 方法查询结果是一个数据集对象,如果需要转换为数组可以使用 Db::tabl...
thinkphp6 数据库查询Db::name('user')->select()查询结果是否为空,用isEmpty
web 0 0
2285 0 2022-06-01 ThinkPHP6
thinkphp6 数据库查询Db::name('user')->select()查询,判断结果是否为空? 数据库的查询结果默认返回数据集对象。 如果要判断数据集是否为空,不能直接使用empty判断,而必须使用数据集对象的isEmpty方法判断, 例如: $users = Db::name('user')-...
php unset从数组中删除某些条目(使用正则表达式)?
web 0 0
1525 0 2022-05-26 PHP
php unset从数组中删除某些条目(使用正则表达式)? 自定义函数 /** * 删除一维数组里的多个key * $isRegular 是否启用正则 1是,0否;$keys='/goodsNo\_(.*)/' */ function ZHTUnset(&$data,$keys,$isRegular=0){ ...
Array and string offset access syntax with curly braces is deprecated原因
web 0 0
1459 0 2022-05-23 PHP
Array and string offset access syntax with curly braces is deprecated PHP7.4不再支持使用大括号访问数组以及字符串的偏移_PHP代码 php7.4不支持数组{}写法,统一为数组[] 解决办法: seq=(ord(value{0}) % $rule...
PHP加密函数—sha1()函数加密
taotaoit 0 0
1404 0 2022-05-23 PHP
sha的全称是:Secure Hash Algorithm(安全哈希算法)主要适用于数字签名标准 (Digital Signature Standard DSS)里面定义的数字签名算法(Digital Signature Algorithm DSA)。对于长度小于2^64位的消息,SHA1会产生一个160位的消息摘要。当接收到消息的时候,...
PHP获取毫秒级时间戳
web 0 0
1428 0 2022-05-23 PHP
PHP本身没有提供获取毫秒级时间戳的函数,java里面可以通过gettime();获取。如果是要与java写的某些程序进行高精度的毫秒级的对接通信,则需要使用PHP输出毫秒级的时间。之前我采取的方法是采用不精准的方式,也就是在PHP原生的时间函数后面加上一个三位数字构成。为获取更为精准的毫秒级时间戳可以使用下面的代码: <?...
php以回车拆分字符串为数组,并去重
taotaoit 1 0
1638 0 2022-05-14 PHP
php以回车拆分字符串为数组,并去重。 文本域textarea提交的数据,根据回车符拆分为数组并去除重复的数组元素。 开始以回车符拆分数组 $keywordsArr = explode(chr(13),$keywords); 但是windows系统和linux系统有差别 所以改为: $keyword...
php格式化日期 用英文3个字母表示月份
taotaoit 0 0
1685 0 2022-05-12 PHP
php格式化日期 用英文3个字母表示月份 echo date('Y-M-j'); 2007-Feb-6 大写M表示月份的3个缩写字符 thinkphp模板中使用:{$vo.create_time|date="M"}
php获取近7天、近30天、近1个月、近1年开始日期和结束日期列表
web 0 0
1794 0 2022-04-26 PHP
//当前日期前30天日期列表 public function getData30Days(){ $days=[]; for ($i=0; $i <=30; $i++) { $days[$i]=date("Y-m-d",strtotime('-'.$i.'day'));...
thinkphp5.1模型查询时间戳create_time,然后作为条件比较大小
taotaoit 0 0
1742 0 2022-04-07 ThinkPHP5.1
thinkphp5.1模型查询时间戳create_time,然后作为条件比较大小 从数据库中查询出时间戳create_time,然后与当前时间比较大小,做后续操作 如果是模型查询 $rs = $this->where()->field("create_time")->find(); 则,$rs...
关于本站

“最难不过坚持”

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

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

8248583 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)