我知道这是一个很简单的问题,但最终它不能工作,而我是一个新手。在index.html中,swf发送一个图像,displayImage.php(下面的代码)应该在另一个页面上显示它。为什么它不工作??
<?php
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {
$no=0;
while (file_exists("images/$no.jpg"))
$no++;
header('Content-Type: image/jpeg');
$image = $GLOBALS["HTTP_RAW_POST_DATA"];
file_put_contents("images/".$no.".jpg", $image);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-9" />
<title>Your Image</title>
<link href= "style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="logo"></div>
<div id="body"></div>
/////////display image//////////
<img src="images/<?$no.".jpg?>">
</body>
</html>发布于 2010-06-23 05:40:58
我删除了行"header('Content-Type: image/jpeg');“,它起作用了!
发布于 2010-06-23 04:14:26
你没有echo文件名(你有一个引号错误,但这可能是一个拼写错误):
<img src="images/<?php echo $no ?>.jpg" />假设存储文件确实有效。
发布于 2010-06-23 04:12:43
<img src="images/<?=$no.".jpg"?>"> https://stackoverflow.com/questions/3096743
复制相似问题