编程语言php 正则转义 $ 符号,一个斜杠不管用?$pattern = "/\{\$/"; preg_match($pattern, $this->content, $matches); var_dump($matches) 没有匹配到 回复内容:$pattern = "/\{\$/"; preg_match($pattern, $this->content, $matches); var_dump($matches) 没有匹配到 因为PHP里双引号内会解析变量,所以换成单引号,或再加个\即可。 $pattern = "/\{\$var/"; // $var变量 $pattern = '/\{\$/'; 在字符串里 字符串中的单个 文章来源:https://www./faq/342299.html |
|