随笔分类 - PHP
摘要:安装了thinkphp8后,在使用验证码时,死活不显示,字体换了几个,路径也正确,就是不显示。 最后,终于发现一个问题,那就是获取的路径的编码有问题,通过转码后,最终验证码显示出来了 给有同样问题的友友们一个经验,碰到不显示的,也可以用我的方法试试 $fontttf = $_SERVER['DOCU
阅读全文
摘要:比如我要查询Elasticsearch库中字段为:id的有没有重复数据,可以用下面的方法,先查询出来,再执行删除。 $from = 0; $size = 0; $url = 'http://127.0.0.1/aaaaaa/_search'; $data['from'] = $from; $data
阅读全文
摘要:其中的条件类似于mysql的where cate_id=$cate_id and (title=$keyword or content=$keyword) $keyword = '常德学院'; $cate_id = 148; $url = 'http://127.0.0.1/aaaaaaa/_sea
阅读全文
摘要:<?php namespace ftp; /** * 作用:FTP操作类( 拷贝、移动、删除文件/创建目录 ) */ class ftp { public $off; // 返回操作状态(成功/失败) public $conn_id; // FTP连接 /** * 方法:FTP连接 * @FTP_H
阅读全文
摘要:为本人原创,转载请注明出处! 一、命令 /** * _search 查询命令 * _update_by_query 更新命令 * _delete_by_query 删除命令 */ 二、指定字段查询 $url = 'http://192.168.10.2:9200/article/_search';
阅读全文
摘要:$aa = 'A、刘禹锡 B、白居易 C、李白 D、柳宗元'; $arr = explode(',',str_replace(array('A、','B、','C、','D、','E、','F、','G、','H、','A.','B.','C.','D.','E.','F.','G.','H.'),
阅读全文
摘要:$order_company_id = '78,43,23,19'; $exp = new \think\Db\Expression('field(web_company.company_id,'.$order_company_id.') desc,web_company.company_sort
阅读全文
摘要:$zip = new ZipArchive(); //参数1:zip保存路径,参数2:ZIPARCHIVE::CREATE没有即是创建 if(!$zip->open("$exportPath.zip",ZIPARCHIVE::CREATE)) { echo "创建[$exportPath.zip]失
阅读全文
摘要:/* + * 功能:删除某个文件夹下所有的文件夹和文件 + * @param string $dir 要删除的文件夹的路径 + */ function del_dir($dir) { if (!is_dir($dir)) { return false; } $handle = opendir($di
阅读全文
摘要:// 原目录,复制到的目录 function recurse_copy($src,$dst) { $dir = opendir($src); @mkdir($dst); while(false !== ( $file = readdir($dir)) ) { if (( $file != '.' )
阅读全文
摘要:#方法一:使用 not in ,容易理解,效率低 ~执行时间为:1.395秒~ SELECT COUNT(1) FROM ecs_goods WHERE ecs_goods.goods_id NOT IN (SELECT ecs_member_price.goods_id FROM ecs_memb
阅读全文
摘要:action('index/index/upload',['参数' => '参数值']); //第一种 controller('index/index')->upload('参数'); //第二种
阅读全文
摘要:$exp =new \think\db\Expression('(SELECT count(*) from `news` where `news`.`comid` = `company`.`comid`) DESC'); $entlist = Db::name('company') ->join('
阅读全文
摘要:问题:使用coreseek搜索关键词发现搜索出来数据还没有mysql模糊查询的数据多。。。问题出在配置的参数上。 代码如下: <?php require_once('sphinxapi.php'); $key = isset($_GET['keys'])?$_GET['keys']:'一个'; $p
阅读全文
摘要:记录一下这种判断写法 $sqlModel = Db::name('news'); $sqlModel = $sqlModel->where('endtime','>=',time()); $sqlModel = $sqlModel->where('begintime','<=',time()); $
阅读全文
摘要:// 仿 Word 统计文章字数,和 word 统计出来的一致 function comment_count_word($str){ //$str =characet($str); //判断是否存在替换字符 $is_tihuan_count=substr_count($str,"龘"); try {
阅读全文
摘要:/* + * 去掉html中的空格和换行的方法 + */ function delhtml($str) { $str = trim($str); //清除字符串两边的空格 $str = strip_tags($str,""); //利用php自带的函数清除html格式 $str = preg_rep
阅读全文
摘要:你在网上搜索tp6的session,会有大量的说开启中间件的文件,无一例个,全都行不通。 当然,中间件里开启是必须的,生成的session文件目录给写入权限也是必须的,但这样,还是无法使用session。 经过搜索,最后发现是需要在方法中加入:\think\facade\Session::save(
阅读全文
摘要:使用环境为php7.3 function createZip($openFile,$zipObj,$sourceAbso,$newRelat = '') { while(($file = readdir($openFile)) != false) { if($file=="." || $file==
阅读全文
摘要:合并数组的方法 array_merge 如:array_merge($data1,$data2); 数组去重 //1.单数组去重复 array_unique($arrTest) //2.多数组去重复 array_keys(array_flip($arr1)+array_flip($arr2))
阅读全文

浙公网安备 33010602011771号