【问题标题】:Regular expression to replace all ' between two tags正则表达式替换两个标签之间的所有'
【发布时间】:2010-12-14 16:54:42
【问题描述】:

如何在 PHP 中用正则表达式将 <?php 和 ?> 标记之间的所有 ' 替换为 '?

我的字符串:<?php $test = 'hello'; ?>

【问题讨论】:

  • 这是怎么发生的?又为什么非得用 PHP 来代替,又不能直接在你的 IDE 里做呢?
  • 那个字符串是从哪里来的?

标签: php regex tags replace


【解决方案1】:
use str_replace

$test =" 'hello';"

str_replace("&apos","'",$test )

【讨论】:

    猜你喜欢
    • 2013-01-24
    • 2020-06-11
    • 2020-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-14
    • 1970-01-01
    相关资源
    最近更新 更多