Pla*_*cid 15
尝试将终端的Git Bash选项更改为xterm-256color.归功于:http://www.techhelp.pw/git-bash-using-laravel-artisan-displays-escaped-characters/
另一个选择是使用--no-ansi开关运行Laravel脚本,这将完全禁用ANSI代码。
小智 7
列出的解决方案都没有对我有用,在Git / etc / bash.bashrc中添加这些行即可解决该问题。
# remove the winpty PHP aliases
unalias $(alias | grep winpty | grep php | cut -d"=" -f1 | cut -d" " -f2)
# support ansi color
export ANSICON=true
Run Code Online (Sandbox Code Playgroud)
我在https://blog.kmelia.net/testing/coloration-dans-git-bash/123找到了解决方案
我在Windows 10上的Windows上使用git bash,我的git版本是2.21.0
希望这可以帮助
颜色代码似乎未正确显示:
[34m是蓝色前景色,并且[39m是默认前景色。
但您将需要一个前缀转义字符:
在 Bash 中,<Esc>可以使用以下语法获取字符:
- \e
- \033
- \x1B
在此处查看更多信息:http://misc.flogisoft.com/bash/tip_colors_and_formatting
这里也讨论了同样的问题:ANSI color escape strings might bad for arc in git bash on windows
基本上提到了黑客修复:
php artisan tinker | cat
php artisan tinker | echo -e
Run Code Online (Sandbox Code Playgroud)
其他一些资源:
git 中的 ANSI 颜色未正确显示
在 Windows 7 上的 Git Bash 中,运行 Cucumber 或 rspec 时颜色显示为代码