dongzi3805 2015-07-16 14:29
浏览 44

使用PHP从文件中删除多行

Let's say I have a file called 'file.php' in which is the following code:

<?php
$var = 'something';
echo '<p>' . $var . '</p>';
?>

Is it possible to delete these lines with PHP, without altering the rest of the file?

  • 写回答

1条回答 默认 最新

  • donglu8779 2015-07-16 14:59
    关注

    Once these lines have been output (sent to the browser) you will not be able to "delete" them solely using PHP.

    You'll need to use a client-side scripting language such as JavaScript to get a handle on the <p> tag for example and then either hide it or remove it from the DOM.

    评论

报告相同问题?