gpt4 book ai didi

php - 如何删除特殊字符,如 : & ) (\/from the string using php?

转载 作者:行者123 更新时间:2023-11-29 06:04:15 25 4
gpt4 key购买 nike

如何从脚本中删除/转义特殊字符

字符串是

echo $position="marketing & executive cum \ stock ";

Outputs are: marketing & executive cum \ stock

但我想要删除后的结果:

output: marketing executive cum stock

这怎么可能?

请问有什么解决办法吗..

最佳答案

使用关注

$position="marketing & executive cum \ stock ";

echo preg_replace('/[^A-Za-z0-9\-\(\) ]/', '', $position);

关于php - 如何删除特殊字符,如 : & ) (\/from the string using php?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42733827/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com