![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
TP
夜清冷、再写
这个作者很懒,什么都没留下…
展开
-
PHP 阿里云OSS存储
/** * 文件上传接口 * */public function uploadFile(){ //接收上传文件 $data = $this->request->param(); $file = $this->request->file('file'); if($_FILES['file']['size']> sysconfig('upload', 'upload_allow_size')) return json(['code' =.原创 2022-02-11 16:10:10 · 417 阅读 · 0 评论 -
PHP 中文转拼音
//中文转拼音function GetFirst($str){ $str= iconv("UTF-8","gb2312", $str);//编码转换 if (preg_match("/^[\x7f-\xff]/", $str)){ $fchar=ord($str); if($fchar>=ord("A") and $fchar<=ord("z") )return strtoupper($str); $a = $str; .原创 2022-01-07 11:02:57 · 100 阅读 · 0 评论 -
PHP微信小程序海报二维码
/** *微信接口调用凭证 */public function checkAuth($appid, $appsecret){ $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $appsecret; $result = $this->httpRequest($url); if ($res.原创 2022-01-07 10:51:36 · 467 阅读 · 0 评论 -
PHP微信小程序登录
public function login(){ // 接收参数 $data = $_POST; $appsecret = preg_replace("/\s/", "", ******); $appid = *******; $code = $data['code']; $iv = str_replace(" ", "+", $data['iv']); $signature = $data['signature']; $rawData =.原创 2022-01-07 10:48:58 · 293 阅读 · 0 评论 -
PHP关于一维数组(键值对)转换二维数组
关于一维数组转换二维数组代码:$arr = []; foreach ($one as $k=>$v) { $arr[$k]['key'] = $k; $arr[$k]['value'] = $v; }这是转换后的原创 2021-08-27 14:45:24 · 910 阅读 · 0 评论 -
PHP 数据库备份
忘记从哪来了,反正主要是方便 要用到话 复制粘贴 改数据库的信息 就OK了 //备份数据库 public function backups() { header('Content-Type:text/html;charset=utf8'); ini_set("max_execution_time", "0");//代码运行时间不限制 防止备份失败 ini_set('memory_limit', '1024M')...原创 2021-08-09 15:38:08 · 571 阅读 · 0 评论 -
PHP关于时间查询
这是一天的$time_daya=strtotime(date('Y-m-d 00:00:01'))*1000;//这是毫秒的时间戳 $time_dayb=strtotime(date('Y-m-d 23:59:59'))*1000;这是一小时的 $time_daya=strtotime(date('Y-m-d H:00:01'))*1000; $time_dayb=strtotime(d...原创 2021-08-03 16:27:02 · 194 阅读 · 0 评论 -
PHP无限极分类
今天翻代码,看到这么一段,不知道以前是去哪里复制,感觉不错,给大家看看/***无限极分类之------规则递归*/static public function RuleList($rule,$pid=0,$lev=1){ $arr=array(); foreach($rule as $v){ if (!isset($v['catid']) || empty($v['catid'])) { $v['catid'] = $v['id']; .原创 2021-07-22 15:56:13 · 155 阅读 · 1 评论 -
PHP 密码加盐
直接上代码PHP加密function salting($password,$encrypt=''){ $pwd = array(); $pwd['encrypt'] = $encrypt ? $encrypt : create_randomstr(); $pwd['password'] = md5(md5(trim($password)).$pwd['encrypt']); return $encrypt ? $pwd['password'] : $pwd;}原创 2021-07-06 16:52:50 · 429 阅读 · 3 评论 -
TP语言转换
1.PHP 代码public function replaceLang(){ $lang=$_GET['lang']; switch ($lang) { case 'cn': session('think_var','zh-cn'); cookie('think_var', 'zh-cn');//lang('succeed')根据语言包里内容进行转换 return $th...原创 2021-07-06 16:32:46 · 257 阅读 · 0 评论