laravel 工匠展示插入“32m”、“34;4m”和类似的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33537366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 12:38:41  来源:igfitidea点击:

Artisan showing inserting "32m", "34;4m" and similar

bashlaravelterminalcommandline

提问by Phillip Y.

I have no idea why but my Git Bash terminal is showing 34m and random numbers in places. Here's a screenshot. enter image description here

我不知道为什么,但我的 Git Bash 终端在某些地方显示 34m 和随机数。这是屏幕截图。在此处输入图片说明

Thanks for any help.

谢谢你的帮助。

回答by Placid

Try changing Git Bash options for terminal to xterm-256color. Credit goes to: http://www.techhelp.pw/git-bash-using-laravel-artisan-displays-escaped-characters/

尝试将终端的 Git Bash 选项更改为 xterm-256color。归功于:http: //www.techhelp.pw/git-bash-using-laravel-artisan-displays-escaped-characters/

回答by Pete

Another option is to run the Laravel scripts with the --no-ansiswitch, which disables the ANSI codes altogether.

另一种选择是使用--no-ansi开关运行 Laravel 脚本,这会完全禁用 ANSI 代码。

回答by Maxime Dezette

None of the solutions listed have worked for me, adding these lines in Git/etc/bash.bashrc solved the problem.

列出的解决方案都没有对我有用,在 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

I have found the solution at https://blog.kmelia.net/testing/coloration-dans-git-bash/123

我在https://blog.kmelia.net/testing/coloration-dans-git-bash/123找到了解决方案

I'm using git bash for windows on Windows 10, my git version is 2.21.0

我在 Windows 10 上为 windows 使用 git bash,我的 git 版本是 2.21.0

Hope this helps

希望这可以帮助

回答by andlrc

It seems like color codes that are not shown correctly:

颜色代码似乎没有正确显示:

[34mis blue foreground and [39mis default foreground color.

[34m是蓝色前景并且[39m是默认的前景色。

But you will need a prefixed escape character:

但是您将需要一个带前缀的转义字符:

In Bash, the <Esc>character can be obtained with the following syntaxes:

  • \e
  • \033
  • \x1B

在 Bash 中,<Esc>可以使用以下语法获取字符:

  • \e
  • \033
  • \x1B

See more here: http://misc.flogisoft.com/bash/tip_colors_and_formatting

在此处查看更多信息:http: //misc.flogisoft.com/bash/tip_colors_and_formatting



The same problem is also discussed here: ANSI color escape sequences seem broken for arc in git bash on windows

此处也讨论了同样的问题:ANSI 颜色转义序列似乎在 windows 上的 git bash 中因弧而损坏

Basically there are mentioned to hackish fixes:

基本上提到了黑客修复:

php artisan tinker | cat 
php artisan tinker | echo -e

A few other resource:

其他一些资源:

ANSI color in git is not displayed correctly
In Git Bash on Windows 7, Colors display as code when running Cucumber or rspec

git 中的 ANSI 颜色显示不正确
在 Windows 7 上的 Git Bash 中,颜色在运行 Cucumber 或 rspec 时显示为代码

回答by Amit K Khanchandani

To Resolve Color issues Download and install thishttps://github.com/adoxa/ansicon

解决颜色问题 下载并安装此https://github.com/adoxa/ansicon

Steps for Installation:

安装步骤

1)Extract The folder and Navigate to x86/64 (Depends upon your system)
2)Open Cmd
3)ansicon.exe -I

Simple :)

简单的 :)

回答by Ikram - Ud - Daula

It's a GIT version compatibility issue.
In my case, remove the latest version and download and install the GIT version 2.10. problem solved. https://github.com/git-for-windows/git/releases/tag/v2.10.0.windows.1

这是一个 GIT 版本兼容性问题。
就我而言,删除最新版本并下载并安装 GIT 2.10 版。问题解决了。 https://github.com/git-for-windows/git/releases/tag/v2.10.0.windows.1

回答by ArneDB

This is a known issue, you should revert the symfony console version

这是一个已知问题,您应该恢复 symfony 控制台版本

https://github.com/laravel/framework/issues/30216

https://github.com/laravel/framework/issues/30216

composer require symfony/console:4.3.4

composer require symfony/console:4.3.4

For more information follow the ticket on the symfony github repo: https://github.com/symfony/symfony/issues/33915

有关更多信息,请关注 symfony github 存储库上的票证:https: //github.com/symfony/symfony/issues/33915

Got my information here: https://laracasts.com/discuss/channels/laravel/php-artisan-not-working-4

在这里获取我的信息:https: //laracasts.com/discuss/channels/laravel/php-artisan-not-working-4

回答by SAYED AREF

only updating the Symfony packages with this command -> composer update symfony/*

仅使用此命令更新 Symfony 包 -> composer update symfony/*