0
I have a file .ini
where I keep some information outside the directory tree of the site, it happens that in a password I have special characters.
The moment php picks up this content it gives problem, the impression I have is that it thinks it is a variable.
Follow a hypothetical example:
In the archive ini
:
[config]
pwd=123456!@#$%
In php file after reading the ini
:
...
leu o ini
$pwd = $Arquivo["config"]["pwd"];
$email_pwd = $pwd;
As the content of "pwd"
la no ini
has character $
, I imagine he understands that it’s a variable, when in fact the $
is part of the string
.
I tried to put in double quotes but it doesn’t work:
$email_pwd = "$pwd";
If I put the literal string with simple quotes it accepts:
$email_pwd = '123456!@#$%';
How to get around this situation to keep the password in the file ini
?
I read the link and understood your example, but another question arose... and if in the password we have double quotes how to escape? , I would quote inside quotation marks? Ex. "test&'&", see that I have double and single quotes inside the string.
– Marcelo
@Marcelo I updated the answer
– Gabriel Heming