在下面的代碼中,第二行將帖子$comment
過帳到Twitter。在mysql_real_escape_string之後,撇號在前面的反斜槓中顯示在Twitter上
當$comment
下面有撇號時,它們在Tweet中加上反斜槓。我如何擺脫Twitter中的反斜槓?
$comment = mysql_real_escape_string($_POST['comment']);
$tweet->post("statuses/update", array("status" => "$comment $fullurl"));
如果您沒有使用UTF-8進行數據庫連接,這可能是原因 – ajreal
除非$ tweet-> post()與數據庫交互,否則不應該使用數據庫轉義函數。 – mario
您也可以從'MRES'切換到'PDO'並停止擔心引號和SQL注入。 –