문제

Does anyone know if question marks arent allowed in the text for the twitter share button? I have the following code and when I click on the share and the popup button appears, the message stops at "Who's your favorite Candidate". It doesnt read the text past the question mark.

<?php
 $text = "Who's your favorite candidate ? This is another message";?>
<a href="https://twitter.com/share?text=<?php echo $text; ?>&url=<?php echo $decoded_url; ?>&hashtags=contesthashtag" class="twitter-share-button" data-lang="<?php echo $lang; ?>" data-hashtags="contesthashtag" data-url="<?php echo $fanpage_url; ?>" data-text="<?php echo $text; ?>">Click here to share on Twitter</a>

THanks alot!

도움이 되었습니까?

해결책

You need to urlencode the text before placing it as a link.

<?php
$text = urlencode("Who's your favorite candidate ? This is another message");
?>

Then pass that $text variable through the twitter share button link.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top