885 篇
建站知识总结与分享
搜索“php”
PHP 向每个二维数组追加元素
web 0 0
1560 0 2022-07-25 PHP
PHP 向每个二维数组追加元素 原数组: $data = [ [ 'first'=>'first_yuansu', 'second'=>'qigemingzi', ], [ 'third'=>'disange', '...
php怎么去掉第一个字符,不要字符串第一个字符
web 0 0
1337 0 2022-07-22 PHP
php怎么去掉第一个字符,不要字符串第一个字符 echo substr("Hello world",1)."<br>"; 输出结果ello world
PHP 随机用户名账号的生成
web 0 0
1723 0 2022-07-21 PHP
// 自动生成随机用户名 // 测试,循环创建1万个随机账号,0碰撞,10万大约0-3个碰撞,足够应付未来数十亿级PV function genUserNumber(){ $chars = "0123456789abcdefghijklmnopqrstuvwxyz"; $username = ""; for ( $i = 0; $...
PHP获取当前页面完整网址URL
web 0 0
1452 0 2022-07-19 PHP
<?php function get_page_url(){ $url = (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HO...
php生成唯一识别码uuid
web 0 0
1735 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
1437 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
1757 0 2022-06-23 Wordpress
wordpress图片路径<?php bloginfo('template_url'); ?>/images/1.jpg
TP6模型事件-查询后onAfterRead不好用
taotaoit 15 0
7168 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
2221 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
2653 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
2373 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
2345 0 2022-06-01 ThinkPHP6
thinkphp6 数据库查询Db::name('user')->select()查询,判断结果是否为空? 数据库的查询结果默认返回数据集对象。 如果要判断数据集是否为空,不能直接使用empty判断,而必须使用数据集对象的isEmpty方法判断, 例如: $users = Db::name('user')-...
php unset从数组中删除某些条目(使用正则表达式)?
web 0 0
1576 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
1520 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
1464 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
1480 0 2022-05-23 PHP
PHP本身没有提供获取毫秒级时间戳的函数,java里面可以通过gettime();获取。如果是要与java写的某些程序进行高精度的毫秒级的对接通信,则需要使用PHP输出毫秒级的时间。之前我采取的方法是采用不精准的方式,也就是在PHP原生的时间函数后面加上一个三位数字构成。为获取更为精准的毫秒级时间戳可以使用下面的代码: <?...
关于本站

“最难不过坚持”

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

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

8434239 2703 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)