php Artisan 命令说:包含空格的 Dotenv 值必须用引号括起来

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43639440/
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-08-26 02:53:11  来源:igfitidea点击:

Artisan command says : Dotenv values containing spaces must be surrounded by quotes

phplaravelartisan

提问by Md. Abu Taleb

I'm trying to know the list of artisan command by using php artisan list. and the command return me the following error [Dotenv\Exception\InvalidFileException] Dotenv values containing spaces must be surrounded by quotes.What is wrong?

我试图通过使用php artisan list. 并且命令返回以下错误 [Dotenv\Exception\InvalidFileException] Dotenv values containing spaces must be surrounded by quotes.是什么问题?

Thanks in advance.

提前致谢。

回答by Alexey Mezenin

You should remove all spaces from .envfile to make an app work again.

您应该从.env文件中删除所有空格以使应用程序再次运行。

If you have to use spaces, instead of this:

如果您必须使用空格,而不是这样:

VAR=some data

Use quotes:

使用引号:

VAR="some data"

回答by Andrew Rayner

Verify your .env file. You need to check for the following:

验证您的 .env 文件。您需要检查以下内容:

  • Any extra or non-needed spaces
  • If you have any strings with spaces, make sure to surround them in quotes
  • 任何额外或不需要的空间
  • 如果您有任何带空格的字符串,请确保用引号将它们括起来

Example:

例子:

varaible=123 Test

Needs to be

需要是

varaible="123 Test"

回答by asha

if you use two word for username or database name in .env,put it inside a double quotation.

如果在 .env 中使用两个词作为用户名或数据库名称,请将其放在双引号内。

example

例子

回答by Kaushik shrimali

First check env.

If your var value with space so check value in double quotes. like,

首先检查环境。

如果您的 var 值带有空格,请检查双引号中的值。喜欢,

 MAIL_FROM_NAME="Sarvajanik School"

If you use single quotes then the possible to got this error containing spaces must be surrounded by quotes

如果您使用单引号,则必须用引号将包含空格的可能出现的错误括起来

回答by nxmohamad

Make sure that:

确保:

  • all variables with spaces are surrounded by quotes
  • there are no semi-colons
  • 所有带空格的变量都用引号括起来
  • 没有分号