<?php
$title = urlencode('Nature');
$url = urlencode('http://amazingpics.net/content/Nature/Amazing%20Nature%20698.jpg');
$image = urlencode('http://trainees.ocs.org/training/hariharan/01-09-2014/images/img2.jpg');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sharing Images</title>
<link href="css/share.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="all">
<div class="top">
<div class="nature" align="center">
<p class="nat">I LOVE NATURE</p>
</div>
<p> </p>
<div class="img"><img src="images/img2.jpg" height="250" width="500" /></div>
<div class="share"><a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=<?php echo $title;?>&p[url]=<?php echo $url; ?>&&p[images][0]=<?php echo $image;?>','sharer','toolbar=0,status=0,width=600,height=400');" href="javascript: void(0)"><img src="images/share.png" width="200" height="40" /></a></div>
<div class="share"><a onClick="window.open('http://twitter.com/intent/tweet?url=<?php echo $url;?>','sharer','toolbar=0,status=0,width=600,height=400');" href="javascript: void(0)"><img src="images/twitter.png" width="200" height="40" /></a></div>
<p> </p>
</div>
</div>
</body>
</html>
我试过上面的代码在Facebook和Twitter上共享图像。它在Facebook上正常工作,但图像无法显示在twitter中。该链接仅显示。请帮助我在twitter上分享图片。在此先感谢...在twitter上使用php共享图像