agid])) {
foreach ($g_flag_thread[$flagid] as &$val) {
flag_thread_filter($val);
}
flag_thread_set($flagid, $g_flag_thread[$flagid]);
}
}
return $g_flag_thread[$flagid];
}
// 设置缓存 $key = flagid / $val = flagid下tid数组
function flag_thread_set($key, $val)
{
global $g_flag_thread;
FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread');
empty($g_flag_thread) and $g_flag_thread = array();
$g_flag_thread[$key] = $val;
return website_set('flag_thread', $g_flag_thread);
}
// 删除flag下tid缓存
function flag_thread_delete_cache($flagid)
{
global $g_flag_thread;
FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread');
empty($g_flag_thread) and $g_flag_thread = array();
if (isset($g_flag_thread[$flagid])) {
unset($g_flag_thread[$flagid]);
website_set('flag_thread', $g_flag_thread);
}
return TRUE;
}
// Delete by tid / 通过tid删除flag下的主题和对应flagid缓存
function flag_thread_delete_by_tid($tid)
{
global $g_flag_thread;
FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread');
if (empty($g_flag_thread)) {
$g_flag_thread = array();
} else {
$thread = well_thread_read_cache($tid);
$arrlist = flag_thread_find($tid, 1, $thread['flags']);
$flagarr = $ids = array();
foreach ($arrlist as $val) {
$flagarr[] = $val['flagid'];
$ids[] = $val['id'];
if (isset($g_flag_thread[$val['flagid']])) unset($g_flag_thread[$val['flagid']]);
}
website_set('flag_thread', $g_flag_thread);
// 主键更新
flag_update($flagarr, array('count-' => 1));
// 主键删除
flag_thread_delete($ids);
}
return TRUE;
}
// 主键删除 通过$flagid删除flag下的主题和对应flagid缓存
function flag_thread_delete_by_flagid($flagid)
{
global $g_flag_thread;
FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread');
$read = flag_read_cache($flagid);
if (empty($read)) return TRUE;
$arrlist = flag_thread_find_by_flagid($flagid, 1, $read['count']);
if (empty($arrlist)) return TRUE;
$flagarr = $ids = array();
$n = 0;
foreach ($arrlist as $val) {
++$n;
$flagarr[] = $val['flagid'];
$ids[] = $val['id'];
if (isset($g_flag_thread[$flagid])) unset($g_flag_thread[$flagid]);
}
website_set('flag_thread', $g_flag_thread);
// 主键更新
flag_update($flagarr, array('count-' => $n));
// 主键删除
$r = flag_thread_delete($ids);
return $r;
}
?>break;
}
$r = array('filesize' => filesize($tmpfile), 'width' => $des_width, 'height' => $des_height);;
copy($tmpfile, $destfile);
is_file($tmpfile) && unlink($tmpfile);
imagedestroy($img_dst);
return $r;
}
/**
* 图片裁切
*
* @param string $sourcefile 原图片路径(绝对路径/abc.jpg)
* @param string $destfile 裁切后生成新名称(绝对路径/rename.jpg)
* @param int $clipx 被裁切图片的X坐标
* @param int $clipy 被裁切图片的Y坐标
* @param int $clipwidth 被裁区域的宽度
* @param int $clipheight 被裁区域的高度
* image_clip('xxx/x.jpg', 'xxx/newx.jpg', 10, 40, 150, 150)
*/
function well_image_clip($sourcefile, $destfile, $clipx, $clipy, $clipwidth, $clipheight, $getimgsize = '')
{
global $conf;
empty($getimgsize) AND $getimgsize = getimagesize($sourcefile);
if (empty($getimgsize)) {
return 0;
} else {
$imgwidth = $getimgsize[0];
$imgheight = $getimgsize[1];
if (0 == $imgwidth || 0 == $imgheight) {
return 0;
}
}
if (!function_exists('imagecreatefromjpeg')) {
copy($sourcefile, $destfile);
return filesize($destfile);
}
switch ($getimgsize[2]) {
case 1 :
$imgcolor = imagecreatefromgif($sourcefile);
break;
case 2 :
$imgcolor = imagecreatefromjpeg($sourcefile);
break;
case 3 :
$imgcolor = imagecreatefrompng($sourcefile);
break;
case 15: // WBMP
$imgcolor = imagecreatefromwbmp($sourcefile);
break;
case 18: // WEBP
$imgcolor = imagecreatefromwebp($sourcefile);
break;
}
if (!$imgcolor) return 0;
$img_dst = imagecreatetruecolor($clipwidth, $clipheight);
imagefill($img_dst, 0, 0, 0xFFFFFF);
imagecopyresampled($img_dst, $imgcolor, 0, 0, $clipx, $clipy, $imgwidth, $imgheight, $imgwidth, $imgheight);
$tmppath = isset($conf['tmp_path']) ? $conf['tmp_path'] : ini_get('upload_tmp_dir') . '/';
'/' == $tmppath AND $tmppath = './tmp/';
$tmpfile = $tmppath . md5($destfile) . '.tmp';
imagejpeg($img_dst, $tmpfile, 75);
$n = filesize($tmpfile);
copy($tmpfile, $destfile);
is_file($tmpfile) && unlink($tmpfile);
return $n;
}
function well_image_ext($filename) {
return strtolower(substr(strrchr($filename, '.'), 1));
}
?>
Windows下的linux子系统之CentOS-软件玩家 - 软件改变生活!
参考文章1
- 说明
wsl安装Ubuntu会更简单,本篇文章介绍如何安装centOS,安装完之后,好多命令初始是没有的。
例如tree命令一开始是没有的,需要yum install tree命令下载,但子系统yum命令一开始也是不可用的,若需要请参考本文下篇的参考文章2
- 链接:https://zhuanlan.zhihu/p/359877706
安装步骤
-
系统配置
-
LxRunOffline
-
CentOS Docker
启用
-
启动命令(有如下几种方式):
LxRunOffline run -n centoswsl -d centosbash
-
使用如下命令查看已安装的子系统:
LxRunOffline l
CentOS镜像使用帮助
参考: http://mirrors.163/.help/centos.html
-
首先备份/etc/yum.repos.d/CentOS-Base.repo:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
-
下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份);例如:centOS7下载地址:
http://mirrors.163/.help/CentOS7-Base-163.repo
常见问题解决
参考文章2:
通过参考文章1,可以运行一些基本的linux命令,但好多命令是不可用的需要通过yum命令下载,本篇文章解决了这个问题
- 链接:https://blog.csdn/Achard_Wang/article/details/122269907
安装 Chocolatey
Chocolatey 是 Windows 环境下的包管理器,其作用等同于 Mac OS 的 Brew,Ubuntu 的 apt,CentOS 的 yum。具体的安装方法参见官方文档。
- 在具有管理员权限的 Powershell 中执行下列命令:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey/install.ps1'))
安装完后更新子系统
- 如果是CentOS,依次执行如下命令:
yum update
yum -y install sudo
设置root用户密码
解决Win10下Linux子系统WSL输入who命令没有响应的内核问题
本文标签:
子系统WindowsLinuxcentos
更多相关文章
Windows 系统网络安全设置
如何关闭不需要的服务 常用的端口有 端口:1-65535 1024以下端口 1.HTTP协议代理服务器常用端口号:808080312880819098 2.SOCKS代理协议服务器常用
windows下利用ftp上传文件到linux(centos7)服务器
1.在linux上安装ftp https:zhidao.baiduquestion176938769145207564.html 2.编写脚本 2.1启动脚本 ftp.bat echo offftp -s:D:maft
【Git学习】Windows系统下如何删除已经保存的账号密码
一、背景 今天QQ群里有人在使用Git命令去clone Gitlab仓库的代码时,第一次弹框提示输入账号密码的时候输错了,然后后面就一直拒绝,不再重复提示输入账号密码&am
windows端口监听失败如何排查处理
问题 windows下有时会出现启动监听端口失败的问题。 排查 这个时候第一是去netstat -ano | findstr 端口号 查询一下端口是否占用 解决 如果端口没有占用的话,可以直接用 net st
Windows命令行修改网卡信息
比如我电脑有这样2个网卡(注意网卡名称) 1.启用禁用网卡 netsh interface set interface JBW disabled netsh interface set int
离线安装OneNote for Windows 10
离线安装OneNote for Windows 10 在探索了一段时间后,找到了离线安装windows uwp应用的方法,特此记录。 准备安装包 通过搜索网页版Microsoft Store
win10重新安装Windows应用商店
安装Windows 终端 用 PowerShell 重装 Microsoft Store使用 MSIX 包重装 Microsoft Store下载安装包及依赖下载Windows 应用商店的安装包安装包是依赖组件包 微软应用商店无法连接网络解
Windows Server2019---01 安装环境
建议有一台自己的电脑,在自己的电脑上进行操作,这样数据既能保存,也能随时随地进行练习 1、VMware安装 VMware官网:https:www
重装系统之后右下角出现激活Windows字样
刚上大学不懂,在激活系统的时候c盘的名称用了自己的中文名,后来在安装有些软件的时候出现很多问题,就想着重装系统,本来我是Win11最后装成了Win10。
Windows Codename“Longhorn“ Build 4074体验
Windows Codename"Longhorn" Build 4074体验 Wimndows Coodename "Longhorn"就是WindowsVista的测试版。今天ÿ
Windows和CentOs下载ZLMediaKit
Windows和CentOs下载ZLMediaKit 一 Window下载ZLMediaKit 首先前提是你在windows下载了git-bash(一个windows下的终端,类似Linux)。 1 在git-b
Windows 上的 Linux 子系统:WSL
安装 WSL 适用于 Linux 的 Windows 子系统(WSL),可以在 Windows 上直接运行 Linux 系统,并且共享文件&#
使用Windows命令行下载网页文件
1、打开PowerShell 搜索栏输入:powershell 2、依次输入 $clientnew-object System.Net.WebClient $client.DownloadFile(https:
如何查看自己的Windows系统是ARM64还是x64架构
WinR 输入systeminfo 如果无效的话在开始菜单的搜索框搜索cmd,然后选择以管理员身份运行,然后再输入systeminfo即可。
适用Linux的Windows子系统
系列文章目录 文章目录 系列文章目录前言 前言 前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到网站,这篇
VMware Horizon Client 5.1.0 for Windows 7 64-bit
VMware Horizon Client 5.1.0 for Windows 7 64-bit 【下载地址】VMwareHorizonClient5.1.0forWindows764-bit 本仓库提供的是适用于Windows 7 64位
windows安装npm(Node.js)教程
在使用之前,先了解下基础定义: npm: nodejs 下的包管理器。 webpack: 它主要用途是通过CommonJS 的语法把所有浏览器端需要发布的静态资源作相应的准备
免费教学Windows Server评估版永久转换为数据中心版攻略
哈喽大家好,欢迎来到虚拟化时代君(XNHCYL),收不到通知请将我点击星标!“ 大家好,我是虚拟化时代君,一位潜心于互联网的技术宅男。这里每天为你分享各种你感兴趣的技术、教程、软件、资源、福利…(每天更新不间断,福利不见不散) 第一章、
【免费下载】 重温经典:MSDN原版Windows 7 with SP1各版本下载推荐
重温经典:MSDN原版Windows 7 with SP1各版本下载推荐 【下载地址】MSDN原版Windows7withSP1各版本下载 - **版本名称**: Windows 7 Ultimate with Ser
【免费下载】 Redis Windows 版本下载
Redis Windows 版本下载 【下载地址】RedisWindows版本下载 本仓库提供了一个适用于 Windows 系统的 Redis 版本下载,具体文件为 redis-windows-7.2.3.zip。Re
发表评论