更新时间:2023-11-19 16:25:34
可以使用单引号或双引号转义包含非字母数字字符的字符串:
Strings containing non-alphanumeric characters can be escaped using single or double quotes:
parameters:
database_password: "my:pass@word!"
如果要使用以@开头的字符串,您必须先转义为@ ,如图书 - 服务容器所述。
If you want to use a string that starts with "@" you must escape it prepending another "@", as stated in The Book - Service Container.
所以,如果你的密码是@mypassword:
So, if your password is "@mypassword":
parameters:
password1: "@mypassword" # Will not work
password2: "@@mypassword" # Will work
这是必需的,因为以单个@开头的字符串用作服务标识符。
This is required because strings starting with a single "@" are used as service identifiers.