< > "

2010-08-14 1 views
4

나는 다음과 같은 코드< > "

'$snippet = &lt;a rel=&quot;nofollow&quot; href=&quot;http://digg.com/submit?phase=2&amp;url=&lt;?php the_permalink(); ?&gt;&quot; title=&quot;Submit this post to Digg&quot;&gt;Digg this!&lt;/a&gt;' 

가 어떻게 rawurlencode를 얻을 수

<a href="snippet:add?code=<?php echo rawurlencode($snippet->snippet_content); ?>Save snippet</a> 

는 "& LT"를 교체해야 rawurlencode 즉에서 entites 교체; "<"으로 변경 하시겠습니까? 미리

많은 감사

아래 포스터 의해 제안

<?php echo rawurlencode(html_entity_decode($snippet->snippet_content)); ?> 

를 사용

업데이트, 고마워요 변화하는 & LT를 해결; 하지만 삽입은

<a rel="nofollow" href="http://delicious.com/post?url=<?php the_permalink(); ?>&title=<?php echo urlencode(get_the_title($id)); ?>" title="Bookmark this post at Delicious">Bookmark at Delicious</a> 

환호가 모든

감사합니다를 고정

을 강탈

aswell 내가 찾고있어 출력은 백 슬래시없이

<a rel=\"nofollow\" href=\"http://delicious.com/post?url=<?php the_permalink(); ?>&title=<?php echo urlencode(get_the_title($id)); ?>\" title=\"Bookmark this post at Delicious\">Bookmark at Delicious</a> 

스 니펫을 통해 \ "<"누구 게시했습니다!

<?php echo rawurlencode(htmlspecialchars_decode(stripslashes($snippet->snippet_content))); ?> 

는 매력,

많은 감사 강탈

+0

귀하의 질문을 수정하십시오

$urlEncodedStr = rawurlencode($str); $urlDecodedStr = rawurldecode($str); $htmlEncodedStr = htmlentities($str); $htmlDecodedStr = html_entity_decode($str); 

당신이 어떤 조합을 할 것 그들을 함께 결합하려면. 코드를 둘러싸거나 각 코드 행 앞에 4 개 이상의 공백을 넣으십시오. –

+0

건배, 첫 번째 글, 수정 됨. –

+0

감사합니다. 'html_entity_decode()'가 여전히 문제를 일으키고 있다고 말합니다.다시 편집하여 사용 후 html 출력을 표시하고 출력 결과를 원하는대로 표시 할 수 있습니까? –

답변

2

당신은 &lt;<에 탈출 the html_entity_decode() function을 사용해야 작동합니다.

그러나 이것은 URL 인자이기 때문에, 당신이 나중에 rawurlencode()를 호출 할 필요가

, 즉

<?php echo rawurlencode(html_entity_decode($snippet->snippet_content)); ?> 
+0

안녕하세요, html_entity_decode를 사용하면 빠른 응답을 보내 주셔서 감사합니다. 링크 텍스트 "Save Snippet"전에 페이지에 코드가 인쇄되거나 표시됩니다. 어떤 아이디어? 건배 –

+0

배경으로 '

3

rawurlencode()는로 변환/HTML 인코딩에서 함께 할 수 없다. URL 인코딩을 수행합니다. 디코딩 할 일치 함수는 rawurldecode()입니다.하지만 여기서는 찾고자하는 것이 아닙니다.

&lt; 인코딩은 html 인코딩입니다. 이를 처리하려면 html_entity_decode()을 디코드하거나 htmlentities()을 인코딩해야합니다. 기능의 위의 세트

기본 사용법은 다음과 같습니다 코드를 볼 수 있도록

$urlEncodedHtmlDecodedStr = rawurlencode(html_entity_decode($str)); 
관련 문제