我有一个HTML表单,用户可以在title
字段中输入文本,然后让php创建一个名为title.html
的HTML文件
我的问题是,用户可以在title字段中输入空格和撇号,而不能在html文件名中使用它们。我用下划线替换了空格,使用:
$FileName = str_replace(" ", "_", $UserInput);
但是,我似乎不能删除单引号?我尝试过使用:
$FileName = preg_replace("/'/", '', $UserInput);
但这让test's
变成了test\s.html
。
https://stackoverflow.com/questions/3903219
复制相似问题