实体字符转码,unicode转码

htmlspecialchars($string, $flag) (Convert special characters to HTML entities 转换特殊字符为HTML实体)

echo htmlspecialchars_decode("'",ENT_QUOTES)  // 输出 '

htmlspecialchars_decode($string, $flag) (与上面相反,将特殊的 HTML 实体转换回普通字符)

echo htmlspecialchars_decode("'",ENT_QUOTES) // 输出 '

docker desktop使用文件映射后,git文件的换行符问题

宿主机 和 docker desktop 容器同时安装git,由于 windows 和 linux 文件的换行符不同(windows 是 CRLF linux 是 LF),每次 pull 修改后,在宿主机使用 git status 看到没有变动,在容器中 git status 看到的是每一行都有变动,是因为系统自动修改了换行符,虽然只用宿主机进行 git 操作不会有什么问题,但是偶尔用容器操作的时候还是感觉很变扭。

解决方法:

git config --global core.autocrlf true

让 git 忽略换行符,执行后,重新 git status ,立刻清爽了。。。