win10 win11 安装require.js

先安装node.js
再

npm install -g requirejs
发表在 js | 留下评论

如何将win11鼠标右键“显示更多选项”设置成默认打开

如何将win11鼠标右键“显示更多选项”设置成默认打开
以管理员身份运行命令提示符输入:

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

敲击回车,然后打开任务管理器找到 “Windows资源管理器”,右键选择重新启动。

如果想要切换回win11版就在cmd中输入以下代码:

    reg.exe delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /va /f
发表在 win11 | 留下评论

PHP模拟进度条

public function ajaxprogress()
    {

        set_time_limit(0);
        // 清除当前的输出缓冲区并禁止输出缓冲,以确保数据能够即时发送给客户端
        ob_end_clean();
        // 设置响应头,指定使用SSE协议,禁用缓存并保持连接 alive
        header('Content-Type: text/event-stream');
        header('Cache-Control: no-cache');
        header('Connection: keep-alive');
        // 对于使用Nginx服务器的情况,禁用缓冲以确保数据即时发送
        header('X-Accel-Buffering: no');

        // 循环模拟持续发送数据的过程
        for ($i = 0; $i < 100; $i++) {
            // 按照SSE格式构建并发送数据,每个数据项之间添加两个换行符以结束数据块
            echo "data: " . $i . "\n\n";
            // 刷新输出缓冲区并强制数据立即发送到客户端
//            ob_flush();
            flush();
            // 暂停一秒以模拟数据生成或处理的过程
            sleep(1);
        }
        exit;
    }
发表在 php | 留下评论

nginx设置允许多个域名跨域

 location / {
       if ($http_origin = 'https://www.nide123.com') {
                add_header 'Access-Control-Allow-Origin' $http_origin  always; 
             }
       if ($http_origin = 'https://nide123.com') {
                add_header 'Access-Control-Allow-Origin' $http_origin  always; 
             }
       if ($http_origin = 'https://www.li2345.com') {
                add_header 'Access-Control-Allow-Origin' $http_origin  always; 
             }
       if ($http_origin = 'https://li2345.com') {
                add_header 'Access-Control-Allow-Origin' $http_origin  always; 
             }
              add_header 'Access-Control-Allow-Origin' 'https://li2345.com' ; 

  }
发表在 linux | 留下评论

css实现的抖动的音符音浪效果

<style>
@keyframes playon{0%{height:70%} 50%{height:100%} 100%{height:35%}}

.play-on {
  display: block;
  height: 8px;
  position: absolute;
  left: calc(50% - 11px);
  bottom: 0;
}
.play-on i {
  width: 4px;
  height: 6px;
  border-radius: 4px 4px 0 0;
  background-color: #E50916;
  position: absolute;
  bottom: 0;
  left: 0;
}
.play-on i:nth-last-child(1) {
  animation: playon .8s .3s infinite;
}

.play-on i:nth-last-child(2) {
  animation: playon .8s .1s infinite;
  left: 6px;
}
.play-on i:nth-last-child(3) {
  animation: playon .6s .2s infinite;
  left: 12px;
}

.play-on i:nth-last-child(4) {
  animation: playon 1s .3s infinite;
  left: 18px;
}

</style>
<em class="play-on"><i></i><i></i><i></i><i></i></em>
发表在 html | 留下评论

查看centos是否支持虚拟化

[root@localhost ~]# cat /proc/cpuinfo

找到flags部分,如果其中输出有SVM或VMX,表明CPU支持虚拟化技术

发表在 linux | 留下评论

前端ajax请求每次提交的PHPSESSID都不一样的bug修复

php服务端,需要在跨域的地方加这个头:
header( 'Access-Control-Allow-Credentials:true' );

前端请求时需要加这个参数
xhrFields:{
withCredentials: true
},
如:

$.ajax({
url: "B. abc.com " ,
xhrFields:{
withCredentials: true
},
});

发表在 js | 留下评论

win10安装和卸载python的坑,无法卸载的3.8.6版本

首先卸载绝对不是在控制面板里卸载就完事了
在控制面板里卸载完 ,在gitbash里运行 python依然提示3.8.6。
这时候在电脑里搜索 python 也一样找不到python
其实因为安装了pip的缘故,
卸载pip
python -m pip uninstall pip
删除所有python的目录即可

最后想安装自定义高级一点的python 建议下载这个免安装版本
python-3.13.0-embed-amd64
直接把文件目录放到一个文件夹,设置系统环境变量path里面新增一个目录,再添加一条 python名字的变量 指向exe路径,如: D:\Program Files\python-3.13.0-embed-amd64\python.exe

这时候python就是最新定义的版本了

发表在 win10 | 留下评论

mysql按月、周、天分组查询数据,原始数据是时间戳

如果直接查询单条数据出来 是会卡爆内存的。所以要在mysql内部分好组。
字段upload_time是日期格式时:

select DATE_FORMAT(upload_time,'%Y%u') weeks,count(SN_ID) count from table_sn group by weeks;  -- 按照周分组
select DATE_FORMAT(upload_time,'%Y%m%d') days,count(SN_ID) count from table_sn group by days;  -- 按照日分组 
select DATE_FORMAT(upload_time,'%Y%m') months,count(SN_ID) count from table_sn group by months;  -- 按照月分组

字段upload_time是时间戳数字格式时:

select DATE_FORMAT(FROM_UNIXTIM(upload_time),'%Y%u') weeks,count(SN_ID) count from table_sn group by weeks;  -- 按照周分组
select DATE_FORMAT(FROM_UNIXTIM(upload_time),'%Y%m%d') days,count(SN_ID) count from table_sn group by days;  -- 按照日分组 
select DATE_FORMAT(FROM_UNIXTIM(upload_time),'%Y%m') months,count(SN_ID) count from table_sn group by months;  -- 按照月分组
发表在 mysql | 留下评论

php给网址替换成链接 正则

因为内容里可能已经带链接的html
所以需要先将链接的代码暂时隐藏,最后再恢复。

 public static function text2link($str='')
    {
        if ($str == '' || !preg_match('/(http|ftp|www\.|@)/i', $str)) {
            return $str;
        }
        $lines = explode("\n", $str . "\n");
        $link = "";
        foreach ($lines as $tt => $vv) {
            $vv = preg_replace("/([ \r\n\t]|^)www\./i", "\\1http://www.", $vv); //www开头自动加http://
            //将现有的链接代码隐藏
            $vv = preg_replace_callback("/href=[\"|']((http|https|ftp):\/\/[^ \r\n]+)[\"|']/i", function ($matches) {
                return "href=\"[link:". base64_encode($matches[1]) ."]\"";
            }, $vv);
            $vv = preg_replace("/((http|https|ftp):\/\/[^ \r\n]+)/i", "<a href=\"\\1\" target='_blank'>\\1</a>", $vv);
//            $vv = preg_replace("/([-a-z0-9_]+(\.[_a-z0-9-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)+))/i", "<a href=\"mailto:\\1\">\\1</a>", $vv);
            //链接代码恢复
            $vv = preg_replace_callback("/\[link:([^\]]+)\]/i", function ($matches) {
                return base64_decode($matches[1]);
            }, $vv);
            $link .= $vv . "\n";
        }
        return $link;
    }
发表在 php | 留下评论