我在本地主机上使用XAMPP APACHE服务器:8080(我不得不更改它的默认端口工作)。假设我有剩下的运行所需的html。 下面是当前的代码:PHP/HTML - 试图使图像显示使用本地主机
home.html的
<body>
<script src="main/profile.php"></script>
</body>
profile.php
<?php
$imagepath ="omj/logo.jpg";
$image = imagecreatefromjpeg($imagepath);
header('Content-Type: image/jpeg');
imagejpeg($image);
?>
我想引用下面的文章不得要领:
http://www.configure-all.com/howto_display_image.php
How to display images from a folder using php - PHP
编辑 我得到的图像通过简单的移动HTML文件夹内的图像文件夹使用HTML工作。现在问题仍然存在,为什么不运行PHP代码来显示图像?
图像路径位于html文件的目录中。就像这样:/htmlfolder/imagefolder/image.jpg而HTML文件/htmlfolder/file.html
显然,这是一个优先事项,有人摔下去投票,而不是给了答案。我仍然不确定如何设置。 Akitha_MJ的答案到目前为止并不奏效。 – Numbers682
为什么你的脚本的src是一个php文件?你似乎对PHP的工作方式有误解。 –
我正在运行一个显示图像的PHP脚本。 – Numbers682