您如何在Twitter共享链接文本中包含&(特定字符“&”)?在 PHP 中


How do you include &( specila characters '&') within Twitter share link text? in php

我得到这样的文本:: 来看看我 iRant !! index.php?path=videopage 通过 @.但实际上我想变成这样::快来看看我 iRant !!index.php?path=videopage&vid='123456' via @

<a href="https://www.twitter.com/intent/tweet?via=&text=Come check me out on iRant !!! index.php?path=videopage&vid='123456'">twitter</a>

当您想在 url 中发送值时,您需要urlencode()您的值:

<a href="https://www.twitter.com/intent/tweet?via=&text=<?php echo urlencode($your_text); ?>">twitter</a>

这适用于可能包含在 url 中无效的字符的所有值。