2011-09-03 5 views
1

(HTML 템플릿 편집기)변수는 내 제어판에있는

<? 
$textarea = '<textarea>'; 
$textarea .= $template_code; 
$textarea .= '</textarea>'; 
echo $textarea; 
?> 

변수 $template_code이 변수가 종료됩니다 의미 </textarea>

for example -> $template_code = '</textarea> ......'; 

포함, HTML을 포함 내 textarea 및 기타 코드는 내 실제 textarea 외부에 있습니다!

어떻게 피할 수 있습니까?

+0

그래서'$ template_code'에는 HTML이 포함되어 있습니까? 텍스트 영역에 HTML을 표시 하시겠습니까? 그런 다음 아마 그것을 피할 것입니다. –

답변

1

htmlentities을 사용하여 특수 문자를 이스케이프합니다.

echo '<textarea>'.htmlentities($template_code).'</textarea>'; 
+0

고맙습니다. 잘 작동합니다. –

+0

이상 : '. –