私は CHttpException(404, $message) 行で 404 を処理しています。$message 変数は、何らかのスタイリングを実現するための HTML 文字列です。しかし、CHttpException() は $message をエンコードし、HTML を役に立たないエスケープ文字列としてレンダリングします。HTMLを出力するために、CHttpExceptionの文字列エンコーディングを回避する方法はありますか?
/**
* From PostsController.php
*/
// ...
public function actionCategory($id)
{
$categoryModel = Categories::model()->findByAttributes(array('idCategory'=>$id));
if($categoryModel===null){
$message = "<div class=\"alert alert-danger\">Page Not Found</div>";
throw new CHttpException(404, $message);
return;
}
// ...