从字符串中删除特殊字符,除了点-PHP
我正在使用phpseclib ssh命令在服务器中删除上传文件。带有空格的文件名很难删除。因此,我正在尝试在上传之前删除文件名的空间。
我已经使用 $ file_name = preg_replace('/\ s+/',',',$ fileName);
它删除了白色空间,但特殊字符也会删除问题。
因此,我已经使用此代码删除特殊字符 Preg_replace('/[^a-Za-Z0-9 \ - ]/','。',$ filename);
,
但此代码删除。
也。 file.zip
变为 filezip
。我想删除特殊字符以及除点符号以外的空间。请帮助
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还尝试了内置功能,但它不起作用。之后,我尝试了一些不同的代码,希望他们能为您提供帮助。如果没有,请尝试将其自定义以获得所需的结果。
I have also tried it with in-built functions but it was not working. After that I have tried some different codes, I hope they will help you. And if not then try to customize it to get the desired result.