我正在为我的自定义模板系统创建一个outcomment preg_replace函数。Preg_replace for/* ... */
我曾尝试以下:
// Outcomment
$pattern[] = "//*(.*?)/*/is";
$replace[] = "";
$content = preg_replace($pattern, $replace, $content);
但我不知道,我很明白的preg_replace工作的方式。
我正在尝试去除/*
和*/
之间的所有内容。
你需要躲避分隔符(这里'/')你的格局里面还有'*'。 – Gumbo 2013-02-17 11:40:28