Home > php教程 > php手册 > 我想将所有的单引号加上一个反斜线。我应该用什么

我想将所有的单引号加上一个反斜线。我应该用什么

WBOY
Release: 2016-06-13 09:54:04
Original
916 people have browsed it

首先,请参考英文的 addslashes() 函数,它能达到你想要的功能,你也应参考php3.ini设定的 magic_quotes_gpc 选项。
函数 ereg_replace()可以达到你要的结果,做法如下:
$escaped = ereg_replace("'", "'", $input);

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template