how to remove html tags in php?

前端 未结 6 1766
时光说笑
时光说笑 2020-12-19 15:26

i posted some data using tinymce (in a symfony project).while retrieving back how can i remove html tags? strip_tags not working..

6条回答
  •  伪装坚强ぢ
    2020-12-19 15:41

    When using Symfony, be sure to use the getRaw() function otherwise the text cannot be stripped from it's HTML code, for example:

    $myText = $sf_data->getRaw('myVarContainingText');

    Then use strip_tags() as such:

    $myText = strip_tags( $sf_data->getRaw('myVarContainingText') );

提交回复
热议问题