Home  >  Article  >  Backend Development  >  preg_replace replacement 问题

preg_replace replacement 问题

WBOY
WBOYOriginal
2016-06-23 13:47:351007browse

preg_replace("/{\.\.\/}2.*\.htm/ie","12312".base64_encode('\\0'), $this->content);失败 


replacement  怎么拼装 “12312 base64_encode(原先匹配到的内容)",一直拼装不成功


回复讨论(解决方案)

preg_replace("/{\.\.\/}2.*\.htm/ie", "‘12312’.base64_encode('\\0')“, $this->content);

preg_replace("/{\.\.\/}2.*\.htm/ie", "‘12312’.base64_encode('\\0')“, $this->content);



谢谢。有用。
多请教一个问题
后面我在连\\0在连123
preg_replace("/{\.\.\/}2.*\.htm/ie","‘12312’.base64_encode('\\0')  \\0 '123'  “, $this->content);

去掉最外层的括号应是一条合法的 php 语句

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn