나는 그것이 매우 간단한 문제이지만 결국에는 작동하지 않으며 나는 초보자라는 것을 알고있다. index.html에서 swf는 이미지를 보내고 displayImage.php (코드 아래)는이를 다른 페이지에 표시해야합니다. 왜 작동하지 않는거야 ??PHP로 이미지를 가져와 html로 표시
<?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>
스크립트 블록 외부에서 '$ no'를 사용할 수 없습니다. –
왜 안되니? 당신은 while 루프를 언급하고 있는데, 이것은 $ not를 선언했기 때문에 무의미하며, php =는 속기이기 때문에 내부에 있지 않기 때문입니다. – peelman