HIS项目介绍、项目环境准备、版本控制介绍、Git基础、Git指针、Git分支、Git标签

news2024/9/25 2:24:37
案例1:项目环境准备
环境准备说明:

本阶段共使用虚拟机6台,操作系统使用RockyLinux8.6

环境准备要求:
  • 最小化安装即可
  • 配置好主机名和IP地址
  • 搭建好yum源
  • 关闭防火墙和SELinux!!!
项目主机列表
主机名IP地址规格角色服务
Programer192.168.88.10/242vCPUs+1GiB+20G程序员主机Git
GitLab192.168.88.20/242vCPUs+4GiB+20G内部代码托管平台GitLab
Jenkins192.168.88.30/242vCPUs+2GiB+20G持续集成工具Jenkins
Services192.168.88.50/242vCPUs+4GiB+20G应用服务器RabbitMQ MySQL Elasticsearch Redis
Backend192.168.88.60/242vCPUs+2GiB+20G后端服务器HIS后端jar包
Fontend192.168.88.70/242vCPUs+1GiB+20G前端服务器Nginx

 环境准备结果

##再次强调:所有主机需关闭防火墙和SELinux,配置好yum源

#搭建本地yum源

[root@Programer ~]# cat /etc/yum.repos.d/rocky.repo 

[BaseOS]

name=RockyLinux_BaseOS

enabled=true

gpgcheck=false

baseurl=file:///dvd/BaseOS


[AppStream]

name=RockyLinux_AppStream

enabled=true

gpgcheck=false

baseurl=file:///dvd/AppStream


#关闭SELinux

[root@Programer ~]# vim /etc/sysconfig/selinux 

[root@Programer ~]# sed -rn '7p' /etc/sysconfig/selinux 

SELINUX=disabled


#禁止firewalld服务开机自启动

[root@Programer ~]# systemctl disable firewalld.service

[root@Programer ~]# reboot


#Programer主机准备

[root@Programer ~]# hostname

Programer

[root@Programer ~]# ifconfig eth0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.88.10  netmask 255.255.255.0  broadcast 192.168.88.255

        

#GitLab主机准备

[root@GitLab ~]# hostname

GitLab

[root@GitLab ~]# ifconfig eth0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.88.20  netmask 255.255.255.0  broadcast 192.168.88.255

        

#Jenkins主机准备

[root@Jenkins ~]# hostname

Jenkins

[root@Jenkins ~]# ifconfig eth0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.88.30  netmask 255.255.255.0  broadcast 192.168.88.255

        

#Services主机准备

[root@Services ~]# hostname

Services

[root@Services ~]# ifconfig eth0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.88.50  netmask 255.255.255.0  broadcast 192.168.88.255

        

#Backend主机准备

[root@Backend ~]# hostname

Backend

[root@Backend ~]# ifconfig eth0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.88.60  netmask 255.255.255.0  broadcast 192.168.88.255

        

#Fontend主机准备

[root@Fontend ~]# hostname

Fontend

[root@Fontend ~]# ifconfig eth0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.88.70  netmask 255.255.255.0  broadcast 192.168.88.255
案例2:Git安装
Programer主机安装Git
#安装中文支持(选做)

[root@Programer ~]# echo $LANG                              #查看当前系统语言及编码

en_US.UTF-8

[root@Programer ~]# yum -y install langpacks-zh_CN.noarch   #安装中文支持

[root@Programer ~]# vim /etc/locale.conf                    #配置系统使用中文及编码

[root@Programer ~]# cat /etc/locale.conf 

LANG="zh_CN.UTF-8"

[root@Programer ~]# reboot                                  #重启使语言配置生效


[root@Programer ~]# echo $LANG                              #确认使用中文编码

zh_CN.UTF-8

[root@Programer ~]# 


#yum源中集成了Git软件包,使用yum安装Git

[root@Programer ~]# yum clean all; yum repolist -v          #插件yum源是否可用

...

Total packages: 8,265

[root@Programer ~]# yum -y install git                      #使用yum安装Git

...

Complete!

[root@Programer ~]# git --version                           #查看Git版本

git version 2.31.1

[root@Programer ~]# git --help                              #查看Git命令帮助信息
案例3:Git版本库操作
回顾Git工作流程

Git基础配置
#Git基础配置

    # --local:  仓库级

    # --global: 全局级

    # --system: 系统级

[root@Programer ~]# git config --global user.name mark              #设置用户名

[root@Programer ~]# git config --global user.email mark@tedu.cn     #设置用户邮箱

[root@Programer ~]# git config --global init.defaultBranch master   #设置版本库默认分支


[root@Programer ~]# git config --list                               #查看已有Git配置

user.name=mark

user.email=mark@tedu.cn

init.defaultbranch=master

[root@Programer ~]# cat ~/.gitconfig                                #查看Git配置持久化文件

[user]

        name = mark

        email = mark@tedu.cn

[init]

        defaultBranch = master

[root@Programer ~]# 
Git创建版本库
  • Git初始化空版本库
#使用Git命令初始化空版本库

[root@Programer ~]# ls

[root@Programer ~]# git init myproject                          #初始化空版本库

已初始化空的 Git 仓库于 /root/myproject/.git/

[root@Programer ~]# ls                                          #确认版本库已创建

myproject

[root@Programer ~]# ls -a myproject/                            

.  ..  .git

[root@Programer ~]# ls -a myproject/.git/

.  ..  branches  config  description  HEAD  hooks  info  objects  refs

[root@Programer ~]# 
  • 将已有目录制作成版本库
#将已有目录制作成Git版本库

[root@Programer ~]# mkdir mytest                                #创建空目录

[root@Programer ~]# ls -a mytest/                               

.  ..

[root@Programer ~]# cd mytest/

[root@Programer mytest]# git init                               #将已有目录制作成Git版本库

已初始化空的 Git 仓库于 /root/mytest/.git/

[root@Programer mytest]# ls -a

.  ..  .git

[root@Programer mytest]# ls -a .git/

.  ..  branches  config  description  HEAD  hooks  info  objects  refs

[root@Programer mytest]# cd

[root@Programer ~]# 
Git版本库操作
#熟悉Git基础命令使用

[root@Programer ~]# cd myproject/

[root@Programer myproject]# git status                          #查看Git本地仓库状态

位于分支 master


尚无提交


无文件要提交(创建/拷贝文件并使用 "git add" 建立跟踪)

[root@Programer myproject]# echo "Learning Git" >> readme.md    #创建readme文件

[root@Programer myproject]# git status                          #查看Git本地仓库状态

位于分支 master


尚无提交


未跟踪的文件:

  (使用 "git add <文件>..." 以包含要提交的内容)

        readme.md


提交为空,但是存在尚未跟踪的文件(使用 "git add" 建立跟踪)

[root@Programer myproject]# git add readme.md                   #将文件信息添加到暂存区

[root@Programer myproject]# git status                          #查看Git本地仓库状态

位于分支 master


尚无提交


要提交的变更:

  (使用 "git rm --cached <文件>..." 以取消暂存)

        新文件:   readme.md


[root@Programer myproject]# git commit -m "add readme"          #将暂存区文件提交到本地仓库

[master(根提交) 09d8603] add readme

 1 file changed, 1 insertion(+)

 create mode 100644 readme.md

[root@Programer myproject]# git status

位于分支 master

无文件要提交,干净的工作区

[root@Programer myproject]# 
Git版本库查询
#查看本地Git版本库信息

[root@Programer myproject]# git log                             #本地版本库提交记录(详细)

commit 09d8603547b7f7c6cf5b2850dd241d4b8b799b74 (HEAD -> master)

Author: mark <mark@tedu.cn>

Date:   Wed Feb 22 15:00:46 2023 +0800


    add readme

[root@Programer myproject]# git log --pretty=oneline            #本地版本库提交记录(简略)

09d8603547b7f7c6cf5b2850dd241d4b8b799b74 (HEAD -> master) add readme

[root@Programer myproject]# git log --oneline                   #本地版本库提交记录(极简)

09d8603 (HEAD -> master) add readme

[root@Programer myproject]# 
Git练习(生成多个版本)
#数量掌握Git本地版本库操作

[root@Programer ~]# cd myproject/

[root@Programer myproject]# echo 123 > test.txt                 #新建test.txt文件

[root@Programer myproject]# git add test.txt                    #将test.txt添加到暂存区

[root@Programer myproject]# git commit -m "add test.txt"        #生成新版本

[master 27466f7] add test.txt

 1 file changed, 1 insertion(+)

 create mode 100644 test.txt

 

[root@Programer myproject]# echo 456 > test.txt                 #修改test.txt文件

[root@Programer myproject]# git add .                           #将修改文件添加到暂存区

[root@Programer myproject]# git commit -m "modify test.txt"     #生成新版本

[master 58cdf79] modify test.txt

 1 file changed, 1 insertion(+), 1 deletion(-)

 

[root@Programer myproject]# echo 789 > test.txt                 #修改test.txt文件

[root@Programer myproject]# git add ./                          #将修改文件添加到暂存区

[root@Programer myproject]# git commit -m "done test.txt"       #生成新版本

[master 0f44bf0] done test.txt

 1 file changed, 1 insertion(+), 1 deletion(-)

 

[root@Programer myproject]# git log --pretty=oneline            #查看本地提交记录(简略)

0f44bf04834eac643a0d56901039cec73128d3cc (HEAD -> master) done test.txt

58cdf7905a95a956fc65da264aab827fc7290dbf modify test.txt

27466f79df8e0cbfd3f8f2349143e054db8ac693 add test.txt

09d8603547b7f7c6cf5b2850dd241d4b8b799b74 add readme

[root@Programer myproject]# git log --oneline                   #查看本地提交记录(极简)

0f44bf0 (HEAD -> master) done test.txt

58cdf79 modify test.txt

27466f7 add test.txt

09d8603 add readme

[root@Programer myproject]# 
案例4:Git指针操作
查看Git指针信息
#使用git log命令查看HEAD指针

[root@Programer ~]# cd myproject/

[root@Programer myproject]# git log --pretty=oneline            #查看Git指针

0f44bf04834eac643a0d56901039cec73128d3cc (HEAD -> master) done test.txt

58cdf7905a95a956fc65da264aab827fc7290dbf modify test.txt

27466f79df8e0cbfd3f8f2349143e054db8ac693 add test.txt

09d8603547b7f7c6cf5b2850dd241d4b8b799b74 add readme

[root@Programer myproject]# cat test.txt                        #查看文件内容

789

[root@Programer myproject]# 
利用指针实现Git版本还原
#reset子命令用于版本还原

    #--soft:缓存区和工作目录不受影响。reset后分支和HEAD指针移动到指定的commit,代码文件内容和reset之前一样,修改部分已加入到暂存区。通常用于重新提交。

    #--mixed:(默认)工作目录不受影响。reset后分支和HEAD指针移动到指定位置,代码文件内容和reset之前一样,修改部分未加入到暂存区。(需要重新执行git add)

    #--hard:工作目录,缓存区均受影响。reset后分支和HEAD指针移动到指定commit,代码文件内容回退到指定commit,工作空间为clean状态。通常用于获取指定版本的代码文件

[root@Programer myproject]# git reset --hard 58cdf7905a     #还原到指定版本

HEAD 现在位于 58cdf79 modify test.txt

[root@Programer myproject]# git log --oneline               #确认HEAD指针移动

58cdf79 (HEAD -> master) modify test.txt

27466f7 add test.txt

09d8603 add readme

[root@Programer myproject]# cat test.txt                    #查看文件内容

456

[root@Programer myproject]# 


#reflog子命令用于获取HEAD指针移动轨迹

[root@Programer myproject]# git reflog 

58cdf79 (HEAD -> master) HEAD@{0}: reset: moving to 58cdf79

0f44bf0 HEAD@{1}: commit: done test.txt

58cdf79 (HEAD -> master) HEAD@{2}: commit: modify test.txt

27466f7 HEAD@{3}: commit: add test.txt

09d8603 HEAD@{4}: commit (initial): add readme

[root@Programer myproject]# git reset --hard 0f44bf0

HEAD 现在位于 0f44bf0 done test.txt

[root@Programer myproject]# git log --oneline

0f44bf0 (HEAD -> master) done test.txt

58cdf79 modify test.txt

27466f7 add test.txt

09d8603 add readme

[root@Programer myproject]# git reflog 

0f44bf0 (HEAD -> master) HEAD@{0}: reset: moving to 0f44bf0

58cdf79 HEAD@{1}: reset: moving to 58cdf79

0f44bf0 (HEAD -> master) HEAD@{2}: commit: done test.txt

58cdf79 HEAD@{3}: commit: modify test.txt

27466f7 HEAD@{4}: commit: add test.txt

09d8603 HEAD@{5}: commit (initial): add readme

[root@Programer myproject]# cat test.txt 

789
案例5:Git分支操作
Git分支管理
#查看当前分支信息,branch子命令

[root@Programer ~]# cd myproject/

[root@Programer myproject]# git status                      #查看本地Git仓库信息

位于分支 master

无文件要提交,干净的工作区

[root@Programer myproject]# git branch -v                   #查看分支信息

* master 0f44bf0 done test.txt

[root@Programer myproject]# 


#创建分支

[root@Programer myproject]# git branch hotfix               #创建hotfix分支

[root@Programer myproject]# git branch feature              #创建feature分支

[root@Programer myproject]# git branch -v                   #查看分支信息

  feature 0f44bf0 done test.txt

  hotfix  0f44bf0 done test.txt

* master  0f44bf0 done test.txt

[root@Programer myproject]# 


#切换分支,checkout子命令

[root@Programer myproject]# git branch -v                   #查看分支信息

  feature 0f44bf0 done test.txt

  hotfix  0f44bf0 done test.txt

* master  0f44bf0 done test.txt

[root@Programer myproject]# git checkout hotfix             #切换分支

切换到分支 'hotfix'

[root@Programer myproject]# git branch -v                   #查看分支信息

  feature 0f44bf0 done test.txt

* hotfix  0f44bf0 done test.txt

  master  0f44bf0 done test.txt

[root@Programer myproject]# git checkout feature            #切换分支

切换到分支 'feature'

[root@Programer myproject]# git branch -v                   #查看分支信息

* feature 0f44bf0 done test.txt

  hotfix  0f44bf0 done test.txt

  master  0f44bf0 done test.txt

[root@Programer myproject]# 


#删除分支

[root@Programer myproject]# git branch develop              #创建develop分支

[root@Programer myproject]# git branch -v

  develop 0f44bf0 done test.txt

* feature 0f44bf0 done test.txt

  hotfix  0f44bf0 done test.txt

  master  0f44bf0 done test.txt

[root@Programer myproject]# git branch -d develop           #删除develop分支

已删除分支 develop(曾为 0f44bf0)。

[root@Programer myproject]# 
Git合并分支
#无冲突分支合并

[root@Programer ~]# cd myproject/

[root@Programer myproject]# git checkout hotfix             #切换到hotfix分支

切换到分支 'hotfix'

[root@Programer myproject]# echo haha > haha.txt            #创建haha文件

[root@Programer myproject]# git add ./                      #添加haha到暂存区

[root@Programer myproject]# git commit -m "add haha.txt"    #生成新版本

[hotfix 108cf46] add haha.txt

 1 file changed, 1 insertion(+)

 create mode 100644 haha.txt

[root@Programer myproject]# ls

haha.txt  readme.md  test.txt

[root@Programer myproject]# cat haha.txt 

haha

[root@Programer myproject]# git checkout master             #切换到master分支

切换到分支 'master'

[root@Programer myproject]# echo xixi > xixi.txt            #创建xixi文件

[root@Programer myproject]# git add ./                      #添加xixi到暂存区

[root@Programer myproject]# git commit -m "add xixi.txt"    #生成新版本

[master 32f0842] add xixi.txt

 1 file changed, 1 insertion(+)

 create mode 100644 xixi.txt

[root@Programer myproject]# ls

readme.md  test.txt  xixi.txt


[root@Programer myproject]# git branch -v                   #切换到master分支

  feature 0f44bf0 done test.txt

  hotfix  108cf46 add haha.txt

* master  32f0842 add xixi.txt

[root@Programer myproject]# git merge hotfix                #合并hotfix分支到master分支

Merge made by the 'recursive' strategy.

 haha.txt | 1 +

 1 file changed, 1 insertion(+)

 create mode 100644 haha.txt

[root@Programer myproject]# ls                              #确认文件

haha.txt  readme.md  test.txt  xixi.txt

[root@Programer myproject]# cat haha.txt 

haha

[root@Programer myproject]# cat xixi.txt 

xixi

[root@Programer myproject]# 


#有冲突分支合并(修改不同分支中相同文件的相同行)

[root@Programer myproject]# git branch -v                   #查看分支

  feature 0f44bf0 done test.txt

  hotfix  108cf46 add haha.txt

* master  b4bea28 Merge branch 'hotfix' 合并hotfix分支

[root@Programer myproject]# git checkout hotfix             #切换到hotfix分支

切换到分支 'hotfix'

[root@Programer myproject]# echo "hahaha" > a.txt           #创建a.txt文件

[root@Programer myproject]# git add .                       #添加到暂存区

[root@Programer myproject]# git commit -m "hotfix"          #生成新版本

[hotfix af8a04b] hotfix

 1 file changed, 1 insertion(+)

 create mode 100644 a.txt

[root@Programer myproject]# git checkout master             #切换到master分支

切换到分支 'master'

[root@Programer myproject]# echo "xixixi" > a.txt           #创建a.txt    

[root@Programer myproject]# git add .                       #添加到暂存区

[root@Programer myproject]# git commit -m "master"          #生成新版本

[master f556200] master

 1 file changed, 1 insertion(+)

 create mode 100644 a.txt

 

[root@Programer myproject]# git merge hotfix                #合并hotfix分支到master分支

冲突(add/add):合并冲突于 a.txt

自动合并 a.txt

自动合并失败,修正冲突然后提交修正的结果。                         #文件冲突,合并失败,手工解决

[root@Programer myproject]# cat a.txt 

<<<<<<< HEAD

xixixi

=======

hahaha

>>>>>>> hotfix

[root@Programer myproject]# vim a.txt                       #手工解决冲突

[root@Programer myproject]# cat a.txt 

xixixi

hahaha

[root@Programer myproject]# git add ./                      #添加到暂存区

[root@Programer myproject]# git commit -m "resolv conflict" #生成新版本,解决冲突

[master 2a6f272] resolv conflict

[root@Programer myproject]# 
案例六:Git标签操作
Git标签管理
#使用tag子命令管理标签

[root@Programer ~]# cd myproject/

[root@Programer myproject]# git tag                         #查看已有标签

[root@Programer myproject]# git tag v1                      #创建v1标签

[root@Programer myproject]# git tag                         #查看已有标签

v1

[root@Programer myproject]# git tag v2                      #创建v2标签

[root@Programer myproject]# git tag                         #查看已有标签

v1

v2

[root@Programer myproject]# git tag -d v2                   #删除v2标签

已删除标签 'v2'(曾为 2a6f272)

[root@Programer myproject]# 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1408549.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

python内置函数有哪些?整理到了7大分类48个函数,都是工作中常用的函数

python内置函数 一、入门函数 1.input() 功能&#xff1a; 接受标准输入&#xff0c;返回字符串类型 语法格式&#xff1a; input([提示信息])实例&#xff1a; # input 函数介绍text input("请输入信息:") print("收到的数据是:%s" % (text))#输出…

“趣味夕阳,乐享生活”小组活动(第二节)

立冬以来&#xff0c;天气日渐寒冷&#xff0c;气温变化较大&#xff0c;各种传染病多发&#xff0c;为进一步增强老年人冬季预防传染病保健意识及科学合理健康的生活方式。近日&#xff0c;1月22日&#xff0c;南阳市人人社工灌涨站开展了“趣味夕阳&#xff0c;乐享生活”小组…

在IntelliJ IDEA中通过Spring Boot集成达梦数据库:从入门到精通

目录 博客前言 一.创建springboot项目 新建项目 选择创建类型​编辑 测试 二.集成达梦数据库 添加达梦数据库部分依赖 添加数据库驱动包 配置数据库连接信息 编写测试代码 验证连接是否成功 博客前言 随着数字化时代的到来&#xff0c;数据库在应用程序中的地位越来…

RS450服务器硬盘亮黄灯故障及从MegaRAID9240-4i阵列卡的恢复业务过程

最近一台ThinkCenter RS450服务器硬盘亮黄灯&#xff0c;引起进入系统很慢&#xff0c;于是将业务系统备份后&#xff0c;对该服务器硬盘进行修复。 该服务器的总共三块硬盘组件了Raid5&#xff0c;因此待第一块盘亮红灯后&#xff0c;尝试进入Raid管理器&#xff0c;将报错的…

gitlab备份-迁移-升级方案9.2.7升级到15版本最佳实践

背景 了解官方提供的版本的升级方案 - GitLab 8: 8.11.Z 8.12.0 8.17.7 - GitLab 9: 9.0.13 9.5.10 9.2.7 - GitLab 10: 10.0.7 10.8.7 - GitLab 11: 11.0.6 11.11.8 - GitLab 12: 12.0.12 12.1.17 12.10.14 - GitLab 13: 13.0.14 13.1.11 13.8.8 13.12.15 - G…

HTML小白入门学习-列表标签

前言 在上一篇文章中&#xff0c;我们学习了下图所示的几个文本格式标签&#xff0c;分别是加粗、斜体、下划线、删除线、下标和上标&#xff0c;忘记了的小伙伴可以回去再看看哦。 在网页中&#xff0c;我们也会经常看到列表&#xff0c;比如某资讯网页的信息列表&#xff…

C# Bitmap类学习1

Bitmap对象封装了GDI中的一个位图&#xff0c;此位图由图形图像及其属性的像素数据组成.因此Bitmap是用于处理由像素数据定义的图像的对象。 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using …

【新加坡机器人学会支持】第三届工程管理与信息科学国际学术会议 (EMIS 2024)

第三届工程管理与信息科学国际学术会议 (EMIS 2024) 2024 3rd International Conference on Engineering Management and Information Science 【国际高级别专家出席/新加坡机器人学会支持】 第三届工程管理与信息科学国际学术会议 (EMIS 2024)将于2024年4月12-14日在中国洛…

SpringBoot项目多数据源配置与MyBatis拦截器生效问题解析

在日常项目开发中&#xff0c;由于某些原因&#xff0c;一个服务的数据源可能来自不同的库&#xff0c;比如&#xff1a; 对接提供的中间库&#xff0c;需要查询需要的数据同步数据&#xff0c;需要将一个库的数据同步到另一个库&#xff0c;做为同步工具的服务对接第三方系统…

黑马Java——面向对象进阶(static继承)

1.static静态变量 静态变量是随着类的加载而加载的&#xff0c;优先与对象出现的

“豚门”、“吗喽”,为啥品牌宣传瞄上网红动物?

近期&#xff0c;新茶饮品牌喜茶联名红山动物园&#xff0c;凭借可爱周边拿捏无数消费者&#xff0c;再往前一段时间&#xff0c;还有奈雪联名“吗喽”表情包&#xff0c;为什么品牌宣传会瞄上网红动物&#xff0c;今天媒介盒子就来和大家聊聊。 一、 萌元素引起用户情绪共鸣 …

C#使用DateTime.Now.AddDays方法获取任一天的信息

目录 一、使用DateTime对象的AddDays方法获取任一天信息方法 二、举例说明获取昨天的信息 三、涉及到的知识点 1. MessageBox.Show(&#xff09;中信息分行的办法 使用DateTime.Now属性可以得到当前的日期信息&#xff0c;此时调用ToString方法&#xff0c;并在该方法中添加…

使用PHP自定义一个加密算法,实现编码配合加密,将自己姓名的明文加密一下

<meta charset"UTF-8"> <?phpfunction customEncrypt($lin, $key mySecretKey){// 定义一个简单的替换规则$li array(L > M, I > Y, Y > O, A > N, E > Q, );$yan ;for($i 0; $i < strlen($lin); $i){$char $lin[$i];if(isset($li[…

27.移除元素(力扣LeetCode)

文章目录 27.移除元素&#xff08;力扣LeetCode&#xff09;题目描述方法一&#xff1a;vector成员函数&#xff1a;erase方法二&#xff1a;暴力解法方法三&#xff1a;双指针法 27.移除元素&#xff08;力扣LeetCode&#xff09; 题目描述 给你一个数组 nums 和一个值 val&…

6.php开发-个人博客项目Tp框架路由访问安全写法历史漏洞

目录 知识点 php框架——TP URL访问 Index.php-放在控制器目录下 ​编辑 Test.php--要继承一下 带参数的—————— 加入数据库代码 --不过滤 --自己写过滤 --手册&#xff08;官方&#xff09;的过滤 用TP框架找漏洞&#xff1a; 如何判断网站是thinkphp&#x…

最小二乘2D圆拟合(高斯牛顿法)

欢迎关注更多精彩 关注我&#xff0c;学习常用算法与数据结构&#xff0c;一题多解&#xff0c;降维打击。 本期话题&#xff1a;最小二乘2D圆拟合 相关背景资料 点击前往 2D圆拟合输入和输出要求 输入 8到50个点&#xff0c;全部采样自圆上&#xff0c;z轴坐标都为0。每个…

算法练习-螺旋矩阵(思路+流程图+代码)

难度参考 难度&#xff1a;中等 分类&#xff1a;数组 难度与分类由我所参与的培训课程提供&#xff0c;但需要注意的是&#xff0c;难度与分类仅供参考。以下内容均为个人笔记&#xff0c;旨在督促自己认真学习。 题目 给定一个正整数n&#xff0c;生成一个包含1到 n^2 所有元…

基于Vue+Canvas实现的画板绘画以及保存功能,解决保存没有背景问题

基于VueCanvas实现的画板绘画以及保存功能 本文内容设计到的画板的js部分内容来源于灵感来源引用地址&#xff0c;然后我在此基础上&#xff0c;根据自己的需求做了修改&#xff0c;增加了其他功能。 下面展示了完整的前后端代码 这里写目录标题 基于VueCanvas实现的画板绘…

面向对象、封装、继承、多态、JavaBean

二、面向对象 什么是对象 什么是对象&#xff1f;之前我们讲过&#xff0c;对象就是计算机中的虚拟物体。例如 System.out&#xff0c;System.in 等等。然而&#xff0c;要开发自己的应用程序&#xff0c;只有这些现成的对象还远远不够。需要我们自己来创建新的对象。 1. 抽…

confluence模版注入漏洞_CVE-2023-22527

1. 漏洞简介 Confluence是Atlassian公司开发的一款专业的企业知识管理与协同软件&#xff0c;可用于构建企业wiki。 Confluence Data Center和Confluence Server多个受影响版本中存在模板注入漏洞&#xff0c;未经身份验证的威胁者可利用该漏洞在受影响的实例上实现远程代码执…