2014-03-07 5 views
3

내 트위터 게시물에 대한트위터 카드에서 동적 이미지 경로를 전달하는 방법은 무엇입니까?

<?php $image='http://abc.in/def.jpg'; ?> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
     <meta name="twitter:card" content="summary"> 
     <meta name="og:image" content="<?php echo $image?>"> 
     <meta name="og:description" content="<?php echo $description; ?>"> 
     <meta name="og:title" content="<?php echo $title; ?>"> 
     <meta name="twitter:url" content="http://keyss.in"> 
     <meta name="twitter:app:id:iphone" content=""> 
     <meta name="twitter:app:id:ipad" content=""> 
     <meta name="twitter:app:id:googleplay" content=""> 
     <meta name="twitter:app:url:iphone" content=""> 
     <meta name="twitter:app:url:ipad" content=""> 
     <meta name="twitter:app:url:googleplay" content=""> 
    </head> 
</html> 

코드를 사용하고 있습니다.

내가 <meta name="og:image" content="http://abc.in/def.jpg"> 이미지의 정적 콘텐츠를 전달

내 트위터 벽에 게시하지만 난 변수를 전달하면 <meta name="og:image" content="<?php echo $image?>"> 이미지는 내 벽에 게시되지 않는.

이미지 콘텐츠에 동적 변수를 전달하려면 어떻게해야합니까?

+0

echo $ image 후에 세미콜론이 누락되었지만 그렇지 않은 경우 코드가 올바르게 보입니다. 출력은 무엇입니까? –

+0

세미콜론도 시도했지만 작동하지 않습니다. – Happy

+0

출력은 무엇입니까? –

답변

0

(코멘트에서 언급 한 바와 같이) $ 이미지가 문제가 될 수 후 누락 된 세미콜론 : 코드를 수정 한 후

<meta name="og:image" content="<?php echo $image; ?>"> 
    <meta name="og:description" content="<?php echo $description; ?>"> 
    <meta name="og:title" content="<?php echo $title; ?>"> 

이 있는지 모든 것을 확인하기 위해 Twitter Card validator를 통해 페이지를 실행 올바르게 나타납니다. 잘하면 당신이 무엇이 잘못되었는지에 대한 아이디어를 줄 것입니다.