如何使用preg_replace php刪除字符串中的font-family樣式?如何使用preg_replace php刪除字符串中的font-family樣式?
我試過使用這段代碼,但沒有工作。我怎樣才能做到這一點 ?
<?PHP
if(isset($_POST["submit"]))
{
$editor = $_POST['editor'];
$editor = preg_replace("#font-family(.*?)>(.*?);#is", "", $editor);
echo $editor;
}
?>
<form class="form" method="post" action="" ENCTYPE = "multipart/form-data">
<textarea name="editor" style="margin: 0px;width: 415px;height: 30px;" ><p style="font-family: fantasy; font-size: 34px;">test</p></textarea>
<br>
<input type="submit" name="submit" value="OK">
</form>
什麼是「#」應該做的? – TigOldBitties
@TigOldBitties'preg_replace'需要圍繞正則表達式的分隔符。它可以是任何角色,他使用'#'。 – Barmar
@Barmar即使它仍然是錯誤的。我從未見過它。最後的「是」是什麼?正如我所說,在他提供的背景下,對我來說這沒有意義。 – TigOldBitties