php - How to add a literal quote in Laravel's .env file?
Get the solution ↓↓↓I'd like to add a string value to my.env
file that contains quotes like so.
APP_NAME="Hacking"
Laravel assumes the quotes are being used to define the string, but I want the literal quote in the string.
I've also tried the following.
APP_NAME='"Hacking"'
APP_NAME=\"Hacking\"
APP_NAME="\"Hacking\""
Answer
Solution:
Try this:
APP_NAME='""Hacking""'
or this:
APP_NAME="\"\"Hacking\"\""
The dotenv library removes the outer layer of single or double quotes when it sets the environment variable: https://github.com/vlucas/phpdotenv/blob/fa1a24d/src/Loader.php#L249
Laravel'senv()
helper removes the outer layer of double quotes when it retrieves the variable:
https://github.com/laravel/framework/blob/2ab2fc6/src/Illuminate/Support/helpers.php#L613
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: script cache:clear returned with error code 255
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.