PHP
蚊子爱喝水
专注、认真
展开
-
thinkphp6 Driver [Think] not supported.
thinkphp6 Driver [Think] not supported.原创 2024-04-11 16:06:31 · 306 阅读 · 0 评论 -
PHP Array and string offset access syntax with curly braces is deprecated
Array and string offset access syntax with curly braces is deprecated原创 2024-04-11 10:10:44 · 252 阅读 · 0 评论 -
PHP8新特性盘点
PHP8的新特性,PHP 8.0.0 已经正式发布了,这个对于PHPer无疑是一个令人振奋的消息。它包含了很多新功能与优化项, 包括命名参数、联合类型、注解、构造器属性提升、match表达式、nullsafe运算符、JIT,并改进了类型系统、错误处理、语法一致性。转载 2023-07-10 11:01:28 · 1050 阅读 · 0 评论 -
PHP实时输出内容到浏览器
PHP实时输出内容到浏览器原创 2023-12-15 17:49:39 · 772 阅读 · 1 评论 -
php怎么获取图片四个角的坐标 x y
php怎么获取图片四个角的坐标原创 2024-01-19 17:00:38 · 652 阅读 · 0 评论 -
Warning: fread(): Length parameter must be greater than 0
Warning: fread(): Length parameter must be greater than 0, fread读取文件数据时$length为什么 必须大于 0原创 2024-03-22 14:15:57 · 530 阅读 · 0 评论 -
thinkphp6 动态开启debug模式
thinkphp6动态开启debug模式原创 2023-07-10 10:41:51 · 2042 阅读 · 0 评论 -
url中的特殊符号及特殊字符编码对照表
URL编码特殊字符%2F,%2B,%3F,%25,URL特殊字符编码对照表原创 2023-08-17 10:37:15 · 6241 阅读 · 0 评论 -
php获取多维数组某个特定键(数组下标)的所有值
php获取多维数组某个特定键(数组下标)的所有值原创 2022-12-30 13:59:33 · 1036 阅读 · 1 评论 -
阿里云CDN API推送
阿里云CDN API推送原创 2022-11-22 17:00:55 · 504 阅读 · 0 评论 -
cURL error 60: SSL certificate problem: unable to get local issuer certifica解决方案
cURL error 60: SSL certificate problem: unable to get local issuer certifica解决方案原创 2022-09-07 14:00:40 · 1332 阅读 · 0 评论 -
百度URL参数之LINK?URL参数加密解密研究(代码实例)
百度URL参数加密解密原创 2022-06-16 10:29:10 · 1407 阅读 · 0 评论 -
thinkphp6动态输出js文件
ob_end_clean();header('Content-Type: text/javascript;charset=UTF-8');echo View::fetch('alter', $param);注意:一定要使用 echo 一定要使用echo 一定要使用echo不要使用return 不要使用return 不要使用return上个三个 缺一不可...原创 2022-02-24 15:39:18 · 810 阅读 · 0 评论 -
PHP移除拼音中的声调
话不多说直接上代码if (!function_exists('remove_tone')) { /** * 移除拼音中的声调 * Author:刘星麟 * @param $txt * @return mixed|string|string[] */ function remove_tone($txt) { $tone = array( 'ā'=>'a', 'á原创 2022-02-10 17:05:33 · 636 阅读 · 0 评论 -
Swoole v5.0 版本新特性预览之新的运行模式
PHP8.1版本已经在 2021 年 11 月 25 日发布了,Swoole 也在第一时间进行了兼容处理,但由于强类型的一些限制,都会导致一些 BC 的情况发生。于是目前将master分支不再作为4.9版本发布,而调整为5.0版本发布,预计发布时间为农历新年后。新的运行模式作为 PHP 开发者都应该知道 PHP 有两种运行模式:php-fpm和php-cli,那么在 Swoole5.0中将迎来一种新的运行模式:swoole-cli。Swoole 将像node.js这样作为独立程序提...转载 2022-01-21 13:49:33 · 523 阅读 · 0 评论 -
常用正则表达式
一、校验数字的表达式数字:^[0-9]*$ n位的数字:^\d{n}$ 至少n位的数字:^\d{n,}$ m-n位的数字:^\d{m,n}$ 零和非零开头的数字:^(0|[1-9][0-9]*)$ 非零开头的最多带两位小数的数字:^([1-9][0-9]*)+(\.[0-9]{1,2})?$ 带1-2位小数的正数或负数:^(\-)?\d+(\.\d{1,2})$ 正数、负数、和小数:^(\-|\+)?\d+(\.\d+)?$ 有两位小数的正实数:^[0-9]+(\.[0-9]{2})?$原创 2021-11-30 10:32:43 · 1082 阅读 · 0 评论 -
PHP使用webuploader实现超大文件分片上传
大文件分片上传原创 2021-08-30 15:17:01 · 796 阅读 · 0 评论 -
php正则替换img标签中的alt属性为空
function replace_img_alt($str) { if (empty($str)) { return $str; } $str = htmlspecialchars_decode($str); preg_match_all('/<img[\s\S]*?src\s*=\s*[\"|\'](.*?)[\"|\'][\s\S]*?>/i', $str, $result, PREG_SET..原创 2021-08-10 10:29:38 · 420 阅读 · 0 评论 -
Nginx配置Thinkphp5.1多入口访问
if (!-e $request_filename) { rewrite /manage.php(.*)$ /manage.php$1 last; rewrite ^(.*)$ /index.php/$1; break;}原创 2021-06-21 11:20:23 · 686 阅读 · 3 评论 -
openssl_pkey_new 返回值为false
$typeNameMap = [ CommonConstant::KEY_PAIR_TYPE_RSA => 'RSA', CommonConstant::KEY_PAIR_TYPE_EC => 'EC', ]; $resource = openssl_pkey_new($configMap[$type]);一直返回false,查了下手册:In case this function returns fals...原创 2021-04-08 18:11:42 · 999 阅读 · 0 评论 -
php源码加密解密
____ __ ______ ____ _________ ___________ / __ \/ / / / __ \ / __ )/ ____/ | / ___/_ __/ / /_/ / /_/ / /_/ / / __ / __/ / /| | \__ \ / / / ____/ __ / ____/ / /_/ / /___/ ___ |___/ // / /_/ /_/ /_/_/ /...转载 2021-03-30 15:13:26 · 2027 阅读 · 0 评论 -
php二分查找算法
二分查找的定义二分查找也称折半查找(Binary Search),它是一种效率较高的查找方法。但是,折半查找要求线性表必须采用顺序存储结构,而且表中元素按关键字有序排列。算法的步骤数据一分为二,然后两边比较,保留有效区间,继续一分为二查找,直到找到或者超出区间则结束,所以二分查找的基本步骤是:确定要查找的区间 确定二分时的参照点 区间内选取二分点 根据二分点的值,舍去一半无用的区间 然后有效区间重复上面的步骤算法源码如下:/** * 二分查找算法 * Author:刘星麟原创 2021-03-17 17:21:41 · 309 阅读 · 0 评论 -
php冒泡排序
冒泡排序的思路是怎么样的呢?首先就是先比较相邻的两个元素,如果满足条件,就交换,否则不动。然后是再比较接下来的两个相邻的元素,然后满足条件就交换,否则依然不动。依次循环操作下去,最终一个元素,会固定在最下边。举例:数组有5个元素从小到大排序,首先第一个和第二个比,第一个比第二个大,就交换,否则不操作然后第二个和第三个比较,第二个大于第三个则交换,否则依然不动。直到对比到第四个和第五个对比。经过一轮的循环对比,最大的数字就下沉到最下边了。小的数字逐渐向上浮出。function原创 2021-03-17 10:49:41 · 74 阅读 · 0 评论 -
php curl 多线程抓取页面
最近公司有个需求,就是查询url 是否被百度收录,第一版使用的是单线程去跑,速度太慢100条数据在20多秒 ,后来改为多线程去跑,速度蹭蹭快,1000条数据大概1秒左右,有需要的朋友可以测试下function curl_multi($array = []) { //创建多个 curl 句柄 $mh = curl_multi_init(); $headers = [ "User-Agent:Mozilla/5.0 (Win.原创 2021-03-16 15:31:08 · 180 阅读 · 0 评论 -
PHP实现自动更新纯真数据库qqwry.dat
自动更新纯真数据库qqwry.dat的原理是:从copywrite.rar中读取解密需要的key,然后解密qqwry.rar头0x200字节数据,然后使用zlib解压数据即可得到qqwry.dat文件。<?php ini_set('max_execution_time', 7200); ini_set("memory_limit", "2048M"); $copywrite = file_get_contents("http://update.cz88.net/ip/copy.原创 2021-02-22 10:25:09 · 457 阅读 · 0 评论 -
PHP中文字符串截取
if (!function_exists('utf_substr')) { /** * 字符串的截取 * Author:刘星麟 * @param $str string 原字符串 * @param $start int 开始截取位置 * @param $len int 截取的长度 * @param $flag string 标志符 * @return string */ function utf_substr(.原创 2021-02-02 09:51:50 · 49 阅读 · 0 评论 -
php 任意编码转utf-8
php 任意编码转utf-8,gkb转utf-8原创 2021-02-01 17:32:55 · 579 阅读 · 0 评论 -
php curl模拟 get post请求
if (!function_exists('curl_data')) { /** * curl 请求 * Author:刘星麟 * @param $url * @param $data * @param string $method 支持 GET POST PUT DELETE * @param string $type * @return bool|string */ function curl_da..原创 2021-01-30 15:28:06 · 253 阅读 · 0 评论 -
PHP生成某个范围内的随机时间
/** * 生成某个范围内的随机时间 * Author:刘星麟 * @param $beginTime 起始时间 格式为 Y-m-d H:i:s * @param string $endTime 结束时间 格式为 Y-m-d H:i:s * @param bool $now 是否是时间戳 格式为 Boolean * @return false|int|string */function random_date($beginTime, $endTime="", $now = true) {.原创 2021-01-30 15:24:09 · 665 阅读 · 0 评论 -
php判断字符串长度
if (!function_exists('str2len')) { /** * 判断字符长度 * Author:刘星麟 * @param string $str * @return float|int */ function str2len($str = '') { $str2len = (strlen($str) + mb_strlen($str, "UTF-8")) / 2; return $s.原创 2021-01-29 18:53:54 · 568 阅读 · 0 评论 -
php检测json数据格式是否正确
主要使用json_last_error 函数 :详情用法,请参考:https://www.php.net/manual/zh/function.json-last-error.phpif (!function_exists('json_validate')) { /** * 检测json数据格式是否正确 * Author:刘星麟 * @param $string * @return bool */ function json_vali.原创 2021-01-29 14:44:52 · 289 阅读 · 0 评论 -
PHP获取当前url请求协议
if (!function_exists('get_request_scheme')) { /** * 获取当前url请求协议 * Author:刘星麟 * @return string */ function get_request_scheme() { return ((int)$_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http') . '://'; }}...原创 2021-01-28 16:46:06 · 717 阅读 · 0 评论 -
以&#开头的是什么编码?php如何将字符串转成ASCII码
今天遇到了一个网页时繁体的,它的title和meta信息在浏览器中显示正常,但是查看其源码是却是“万博彩”这种。网上找了资料后,得知,网页中&#开头的是HTML实体,一些字符在 HTML 中是预留的,拥有特殊的含义,那么问题来了,中文汉字是转如何换成HTML实体的呢?其实很简单,汉字的HTML实体由三部分组成,”&#+ASCII+;“ 即可。例如,把“欢迎点赞收藏” 转换成“欢&原创 2021-01-27 14:10:04 · 2458 阅读 · 0 评论 -
getimagesize - failed to open stream: HTTP request failed
$url = "https://thumb1.jfcdns.com/thumb/n131k31t23s13/16f5fc6ef8300d07_600_0.jpeg";$info = getimagesize($url);先看代码:问题分析: 浏览器可以正常打开,getimagesize 打开出问题猜想到是不是图片设置了 只能浏览器请求,顺着自己的猜想 有了 下面的代码ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 7.0b; Wi.原创 2020-12-03 17:43:33 · 938 阅读 · 0 评论 -
PHP 常用注释说明
@api: 提供给第三方使用的接口 @author: 标明作者 @param: 参数 @return: 返回值 @todo: 待办 @version: 版本号 @inheritdoc: 文档继承 @property: 类属性 @property-read: 只读属性 @property-write: 只写属性 @const: 常量 @deprecated: 过期方法 @example: 示例 @final: 标识类是终态, 禁止派生 @global: 指明引用的全局变量 @st原创 2020-11-11 15:04:47 · 1478 阅读 · 0 评论 -
phpstorm配置swoole自动补全
1、安装swoole-ide-helpercomposer require easyswoole/swoole-ide-helper2、打开phpstorm点击应用就OK了原创 2020-11-10 15:56:37 · 1394 阅读 · 0 评论 -
Unzip with unzip command failed, falling back to ZipArchive class
今天composer 安装easyswoole时:原因:缺少unzip依赖,php-zip 扩展依赖 unzip 命令解决办法:安装 zip、unzip 命令yum install unzip zip -y安装完扩展后,从新composer安装原创 2020-11-10 11:40:16 · 1979 阅读 · 0 评论 -
Centos安装php7 zip 扩展
安装之前先检车服务器是否 安装了 libzip (安装libzip 需要 cmke)最新版本请参考官网:https://nih.at/libzip/yum install -y cmakewget https://libzip.org/download/libzip-1.2.0.tar.gztar -zxvf libzip-1.2.0.tar.gzcd libzip-1.2.0.tar.gzmkdir build && cd build && /usr/..原创 2020-11-04 15:59:00 · 474 阅读 · 0 评论 -
PhpStorm函数注释的设置
首先,PhpStorm中文件、类、函数等注释的设置在:setting-》Editor-》FIle and Code Template-》Includes下设置即可,其中方法的默认是这样的:/** ${PARAM_DOC} #if (${TYPE_HINT} != "void") * @return ${TYPE_HINT} #end ${THROWS_DOC}...原创 2019-04-22 10:19:50 · 1367 阅读 · 0 评论 -
composer 忽略版本检测
今天升级框架的时候,直接不能更新,提示版本要求解决办法 加上--ignore-platform-reqscomposer update --ignore-platform-reqs原创 2020-10-26 10:23:29 · 1403 阅读 · 0 评论