0
$字符我使用下面的函数:PHP忽略字符串
function replace_password_line($data) {
$password = "Ga$man";
if (stristr($data, 'password_here')) {
return str_replace('password_here', $password, $data);
}
return $data;
}
我的问题是这样的字符串内的$正与一个变量,在“password_here”的输出结果弄得跟“嘎被替换“...... $以及之后的所有内容都将被废除。似乎是它与变量混淆。
我该如何解决这个问题?我可以在字符串中使用$吗?
无论是'\ $'还是使用单引号。 – AbraCadaver
谢谢你们两位 – cpcdev