2014-02-24 2 views
-2

다른 웹 페이지 소스가 포함 된 웹 페이지가 있습니다. 페이지 소스의 HTML 코드를 일반 페이지 소스로 변환 -

<html> 
.... 
<div id="content"> 
{"note":"\n<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<!--[if IE 9]>\n\t\t\t<script src=\"\/js\/PIE\/PIE_IE9.js\"><\/script>\n\t\t\t<link rel=\"stylesheet\"... 
</div> 

그래서 난

<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<!--[if IE 9]>\n\t\t\t<script src=\"\/js\/PIE\/PIE_IE9.js\"><\/script>\n\t\t\t<link rel=\"stylesheet\"... 

같은 문자열을 가지고 내가

<!DOCTYPE html><html><head><!--[if IE 9]><script src="\js\PIE\PIE_IE9.js"></script><link rel="stylesheet". 

을 좀하고 싶습니다 것처럼 \n, \t, \ "와 같은이 특별한 문자를 제거 할 수있는 PHP 함수가 있나요 보인다 "... 일반 HTML 코드가 필요합니다.

미안 내 영어 지적 한 바와 같이

+0

왜 소스에서하지 않습니까? 와우, 최종 출력 메이트에서'\ n'을 모두 갖는 것은 나쁘다 ... 적절하지 않다 .. – jycr753

+0

json 문자열인가? 그렇다면'json_decode' -> http://th1.php.net/json_decode를보십시오. – Hereblur

+0

다른 페이지에서 렌더링하면 형식이 잘못된 HTML이됩니다. –

답변

0

,이 작업을 수행하는 더 나은 방법 그러나, 거기에이 특수 문자를 대체 할

$string = "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<!--[if IE 9]>\n\t\t\t<script src=\"\/js\/PIE\/PIE_IE9.js\"><\/script>\n\t\t\t<link rel=\"stylesheet\""; 
echo preg_replace('/\r|\n|\t|\\\/', '', $string); 

\n, \t, \r\

+0

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