【问题标题】:php filter with get variables [closed]带有获取变量的php过滤器[关闭]
【发布时间】:2013-08-18 15:49:40
【问题描述】:

我很讨厌正则表达式,但我想做一个简单的过滤器,其中 / 替换为 1," 替换为 2,

replace(/,1)
replace(",2)
replace(<,3)

。 谢谢。

【问题讨论】:

  • 你有没有试过研究这些?
  • strtr 在这里更合适。

标签: php variables filter get


【解决方案1】:

我真的不认为这里需要正则表达式。你可以使用str_replace

例如

str_replace('/', '1', $_GET['var']);

【讨论】:

    猜你喜欢
    • 2019-11-01
    • 2013-10-18
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 2011-06-10
    相关资源
    最近更新 更多