随笔分类 -  [02]PHP

上一页 1 2 3 4 5 6 7 8 9 ··· 25 下一页
摘要:define('BASE_PATH',str_replace('\\','/',realpath(dirname(__FILE__).'/'))."/"); 将这个代码放在入口index.php,将可以在别的地方使用到。 比如配置全局日志。 // 全局通用日志工具 function setlog($ 阅读全文
posted @ 2020-06-16 17:01 TBHacker 阅读(1761) 评论(0) 推荐(0) 编辑
摘要:# sudo composer require doctrine/instantiator <?php require 'vendor/autoload.php'; require_once 'hello.php'; // 如果不存在,将报错 // class hello { // public f 阅读全文
posted @ 2020-06-15 21:01 TBHacker 阅读(250) 评论(0) 推荐(0) 编辑
摘要:先备份 sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup 新建 sudo vim /etc/apt/sources.list 更改为清华源 #清华源 deb https://mirrors.tuna.tsinghua.edu.cn/ 阅读全文
posted @ 2020-06-15 20:35 TBHacker 阅读(1741) 评论(0) 推荐(0) 编辑
摘要:composer require yzalis/identicon 使用 /** * 获取头像 */ public function getAvatar($uid = '') { $identicon = new \Identicon\Identicon(); if ($uid) { $result 阅读全文
posted @ 2020-06-15 18:02 TBHacker 阅读(279) 评论(0) 推荐(0) 编辑
该文被密码保护。
posted @ 2020-06-10 17:36 TBHacker 阅读(6) 评论(0) 推荐(0) 编辑
摘要:# sqlversion.php sqlversion_file=${cur_dir}/web-admin/sql_version/sqlversion.php sed -i "s#^\$db_host.*;#\$db_host='${DB_HOST}';#g" $sqlversion_file s 阅读全文
posted @ 2020-06-10 16:53 TBHacker 阅读(9804) 评论(0) 推荐(0) 编辑
摘要:function colorize($text, $status) { $out = ""; switch ($status) { case "SUCCESS": case "Green": $out = "[32m"; //Green break; case "FAILURE": case "Re 阅读全文
posted @ 2020-06-10 15:16 TBHacker 阅读(434) 评论(0) 推荐(0) 编辑
摘要:shell #!/bin/bash host=${DB_HOST} dbname=${DB_NAME} user=${DB_USER} pwd=${DB_PWD} # 只能通过单字母传参数 create_res=`php ${cur_dir}/init/createdb.php -h $host - 阅读全文
posted @ 2020-06-10 14:44 TBHacker 阅读(671) 评论(0) 推荐(0) 编辑
摘要:mysqli <?php $servername = "localhost"; $username = "root"; $password = "123456"; $dbname = "test"; // 创建连接 $conn = new mysqli($servername, $username, 阅读全文
posted @ 2020-06-09 14:53 TBHacker 阅读(719) 评论(0) 推荐(0) 编辑
摘要:案例1: <?php // 表示由数据库返回的可能记录集的数组 $a = array( array( 'id' => 5698, 'first_name' => 'Bill', 'last_name' => 'Gates', ), array( 'id' => 4767, 'first_name' 阅读全文
posted @ 2020-05-29 09:36 TBHacker 阅读(794) 评论(0) 推荐(0) 编辑
摘要:模拟昵称,随机时间,数组合并,数组去重,数组排序。 阅读全文
posted @ 2020-05-18 16:43 TBHacker 阅读(215) 评论(0) 推荐(0) 编辑
摘要:``` /** * 数组去重 */ public function arrayUnique($arr) { $count = count($arr); $res = []; for ($i = 0;$i < $count ;$i++) { $tmp = $arr[$i]; unset($arr[$i]); if (!in_array($tmp,$arr)) { $res[] = $tmp; } } 阅读全文
posted @ 2020-05-18 15:42 TBHacker 阅读(432) 评论(0) 推荐(0) 编辑
摘要:``` /** * 将时间转换为几秒前、几分钟前、几小时前、几天前 * @param $in_time 需要转换的时间字符串 * @return string */ public static function timeTran($in_time) { $now_time = time(); $in_time = strtotime($in_time); $dur = $now_time - $i 阅读全文
posted @ 2020-05-15 18:48 TBHacker 阅读(290) 评论(0) 推荐(0) 编辑
摘要:base64记录查询参数! https://github.com/dankogai/js base64 首页,获取查询参数! 取消,或者完成编辑的时候,解析Base64 小结 base64的好处是能够存储无数个参数!一个参数,能够解决传入参数问题! 阅读全文
posted @ 2020-05-11 16:36 TBHacker 阅读(188) 评论(0) 推荐(0) 编辑
摘要:html,js php 一天的,按照24小时展示,超过1天的,按天展示。范围不可超过30天。 阅读全文
posted @ 2020-05-06 15:26 TBHacker 阅读(333) 评论(0) 推荐(0) 编辑
摘要:创建订单的时候,扣库存,扣优惠券。 订单取消的时候,回滚库存,回滚优惠券。 这种方式,能够避免多使用,多卖出。(支付完成时,扣库存,容易多卖) 阅读全文
posted @ 2020-04-18 14:54 TBHacker 阅读(409) 评论(0) 推荐(0) 编辑
摘要:``` /** * 比较时段是否重复 * 跨越0点 * 8:00~02:00 * 23:00~01:00 * 01:00~03:00 */ public static function isTimeCross($beginTime1,$endTime1,$beginTime2,$endTime2) { if (strtotime($beginTime1) > strtotime($endTime1 阅读全文
posted @ 2020-04-13 21:37 TBHacker 阅读(268) 评论(0) 推荐(0) 编辑
摘要:2020 04 13 24:00 与 2020 04 14 00:00 一致 阅读全文
posted @ 2020-04-13 20:23 TBHacker 阅读(293) 评论(0) 推荐(0) 编辑
摘要:通过变量extend,和type可以支持多种模板短信发送。 阅读全文
posted @ 2020-04-13 14:30 TBHacker 阅读(257) 评论(0) 推荐(0) 编辑
摘要:``` where(array('key'= $key)) find(); if ($r !== false) { // 添加 $data = [ 'key' = $key, 'value' = $val, 'create_time'= time() ]; return $configs add($ 阅读全文
posted @ 2020-04-11 14:06 TBHacker 阅读(219) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 25 下一页