组保留的标签 余下为需要删除的标签
unset($oldtag[$key]);
}
}
}
if (!empty($oldtag)) {
$tagids = array();
foreach ($oldtag as $tagid => $tagname) {
$tagids[] = $tagid;
}
well_oldtag_delete($tagids, $tid);
}
$r = well_tag_process($tid, $fid, $create_tag, $tagarr);
return $r;
}
// 删除标签和绑定的主题
function well_oldtag_delete($tagids, $tid)
{
$pagesize = count($tagids);
$arrlist = well_tag_find_by_tagids($tagids, 1, $pagesize);
$delete_tagids = array(); // 删除
$tagids = array();
$n = 0;
foreach ($arrlist as $val) {
++$n;
if (1 == $val['count']) {
// 只有一个主题
$delete_tagids[] = $val['tagid'];
} else {
$tagids[] = $val['tagid'];
}
}
!empty($delete_tagids) and well_tag_delete($delete_tagids);
$arlist = well_tag_thread_find_by_tid($tid, 1, $n);
if ($arlist) {
$ids = array();
foreach ($arlist as $val) $ids[] = $val['id'];
well_tag_thread_delete($ids);
}
!empty($tagids) and well_tag_update($tagids, array('count-' => 1));
}
// 标签数据处理 $arr=新提交的数组 $tagarr=保留的旧标签
function well_tag_process($tid, $fid, $new_tags = array(), $tagarr = array())
{
if (empty($tid)) return '';
// 新标签处理入库
if ($new_tags) {
$threadarr = array();
$tagids = array();
$i = 0;
$size = 5;
$n = count($tagarr);
$n = $n > $size ? $size : $size - $n;
foreach ($new_tags as $name) {
++$i;
$name = trim($name);
$name = stripslashes($name);
$name = strip_tags($name);
$name = str_replace(array(' ', '#', "@", "$", "%", "^", '&', '·', '<', '>', ';', '`', '~', '!', '¥', '……', ';', '?', '?', '-', '—', '_', '=', '+', '.', '{', '}', '|', ':', ':', '、', '/', '。', '[', ']', '【', '】', '‘', ' ', ' ', ' ', ' ', ' '), '', $name);
$name = htmlspecialchars($name, ENT_QUOTES);
if ($name && $i <= $n) {
// 查询标签
$read = well_tag_read_name($name);
if ($read) {
// 存在 count+1
$tagids[] = $read['tagid'];
} else {
// 入库
$arr = array('name' => $name, 'count' => 1);
$tagid = well_tag_create($arr);
FALSE === $tagid and message(-1, lang('create_failed'));
$read = array('tagid' => $tagid, 'name' => $name);
}
$tag_thread = array('tagid' => $read['tagid'], 'tid' => $tid);
$threadarr[] = $tag_thread;
$tagarr[$read['tagid']] = $read['name'];
}
}
!empty($threadarr) and tag_thread_big_insert($threadarr);
!empty($tagids) and well_tag_update($tagids, array('count+' => 1));
}
$json = empty($tagarr) ? '' : xn_json_encode($tagarr);
return $json;
}
?> $v = implode(",", $v);
$temp[] = $v;
}
// 去掉重复的字符串,也就是重复的一维数组
$temp = array_unique($temp);
// 再将拆开的数组重新组装
$output = array();
foreach ($temp as $k => $v) {
if ($stkeep) $k = $starr[$k];
if ($ndformat) {
$temparr = explode(",", $v);
foreach ($temparr as $ndkey => $ndval) $output[$k][$ndarr[$ndkey]] = $ndval;
} else $output[$k] = explode(",", $v);
}
return $output;
}
// 合并二维数组 如重复 值以第一个数组值为准
function array2_merge($array1, $array2, $key = '')
{
if (empty($array1) || empty($array2)) return NULL;
$arr = array();
foreach ($array1 as $k => $v) {
isset($v[$key]) ? $arr[$v[$key]] = array_merge($v, $array2[$k]) : $arr[] = array_merge($v, $array2[$k]);
}
return $arr;
}
/*
* 对二维数组排序 两个数组必须有一个相同的键值
* $array1 需要排序数组
* $array2 按照该数组key排序
* */
function array2_sort_key($array1, $array2, $key = '')
{
if (empty($array1) || empty($array2)) return NULL;
$arr = array();
foreach ($array2 as $k => $v) {
if (isset($v[$key]) && $v[$key] == $array1[$v[$key]][$key]) {
$arr[$v[$key]] = $array1[$v[$key]];
} else {
$arr[] = $v;
}
}
return $arr;
}
?>
重装系统后github的各项配置编程频道|福州电脑网
重装系统后github的各项配置 编程之家 92 0
更新时间:2026-04-03 20:28:22
重装系统后github的各项配置
写在前面
生活中,总是遇到各种问题,然后重装系统。可是重装后,电脑里的 github 各项配置没啦,每次在重新配置急需要半天,很烦。所以就记录一下本次配置内容,以便自己备用,也方便新手学习。
首先要安装git,这里就不多说了,默认大家都已安装完毕。
设置姓名和邮箱地址
git config --global user.name "Firstname Lastname"git comnfig --global user.email "your_email@example"配置公私密钥。
ssh -keygen -t rsa -C "your_email@example"
三次回车
添加公开密钥
id_rsa 文件是私有密钥,id_rsa.pub 是公开密钥 打开GitHub进入 settings 选择 SSH and GPG keys 点击Add SSH Key,title 中输入密钥名称,key 中输入 id_rsa.pub 文件里的内容。 通过命令cat ~/.ssh/id_rsa.pub打印密钥内容,然后把密钥内容贴入 key 中。 成功之后,创建用户的邮箱将会收到一封提示“密钥添加完成的邮件” 完成以上内容后,就可以用手中私人密钥与GitHub进行认证和通信。
$ ssh -T git@github
The authenticity of host 'github (192.*.*.*)' can't be established.
RSA key fingerprint is SHA256:nThbg*****6 kXU***pJWGl7E1IG*****.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github,192.*.*.*' (RSA) to the list of known hosts.
Enter passphrase for key '/c/Users/用户名/.ssh/id_rsa':
Enter passphrase for key '/c/Users/用户名/.ssh/id_rsa':
Hi user! You've successfully authenticated, but GitHub does not provide shell access.
5 . 初始化仓库 git init
6 . 添加远程仓库
`git remote add origin git@github:用户名/远程仓库名.git`
7 . 从远程仓库下载到本地仓库
`git clone git@github:用户名/远程仓库名.git`
至此,普通的GitHub仓库已克隆到本地。并且保证仓库的完整性。
对于之前hexo+github搭建的博客的一些配置更改
安装 git和node.js
### Windows 用户 对于windows用户来说,建议使用安装程序进行安装。安装时,请勾选Add to PATH选项。 另外,您也可以使用Git Bash,这是git for windows自带的一组程序,提供了Linux风格的shell,在该环境下,您可以直接用上面提到的命令来安装Node.js。打开它的方法很简单,在任意位置单击右键,选择“Git Bash Here”即可。由于Hexo的很多操作都涉及到命令行,您可以考虑始终使用Git Bash来进行操作。 安装hexo
$ npm install -g hexo-cli使用git clone git@github:用户名/用户名.github.io.git拷贝仓库(默认分支为hexo);
在本地新拷贝的用户名.github.io文件夹下通过Git bash依次执行下列指令:npm install hexo、npm install、npm install hexo-deployer-git(记得,不需要hexo init这条指令)
本文发布于:2025-03-18,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签: 重装系统 Github
发布评论