public function actionError()
{
/* @var HttpException $exception */
$exception = \Yii::$app->getErrorHandler()->exception;
return $this->render('errors/' . $exception->statusCode, [
'name' => '',
'message' => $exception->getMessage(),
'exception' => $exception,
]);
}
$text=<<<t
hellow <b>test</b> <iframe src=javascript>browser is bad!</iframe>
<script>alert('hi');</script>
test2<br>
<script>alert('hi');</script>
test3
t;
$text=preg_replace('#(\<iframe.*?\/iframe>)#u',"",$text);
$text=preg_replace('#(\<script.*?\/script>)#u',"",$text);
$text=preg_replace('#(\<(\/?[^>]+)>)#u',"",$text);
$text=preg_replace('#((\n\r)+)#u',"",$text);
echo "<pre>".$text."</pre>";
/*
hellow test
test2
test3
*/