【发布时间】:2013-05-31 16:20:59
【问题描述】:
我正在为摄影师建立一个网站,我使用 iframe 将不同的图片作为一条长条图片包含到网站中。这在 chrome safari en firefox 中运行良好,但在 Internet Explorer 中似乎不起作用? 这是我使用 iframe 的文件
<?php
include 'core/init.php';
include 'includes/overall/overalheader.php';
include 'includes/aside.php';
if (isset($_GET['id']) === true && empty($_GET['id']) === false) {
$_SESSION['serie_id'] = $_GET['id'];
$lengte = lengte_frame($_SESSION['serie_id']);
?>
<iframe src="includes/fotos.php" frameborder="0" height="520px" width="<?php echo $lengte; ?>px"></iframe>
<?php
}
else {
echo 'hallee dermee';
}
include 'includes/overall/overalfooter.php';?>
这是 fotos.php 文件
<?php
include '../core/init.php';
$tekst = get_tekst($_SESSION['serie_id']);
$fotos = get_fotos($_SESSION['serie_id']);
?>
<div width="135" style="float:left; padding-left:15; border:1; max-width:200"></div>
<?php
$count = 0;
foreach ($fotos as $foto) {
if ($count == 0) {
$breed = 160;
} else {
$breed = 15;
}
echo '<div style="float:left; padding-left:' . $breed . '" width="' . $foto['width'] . '"><img src="../' . $foto['path'] . '" height="' . $foto['height'] . '" width="' . $foto['width'] . '"></div>';
$count++;
}
if (empty($tekst) === false) {
echo '<table style="float:left; padding-left:15;" width="200"><tr><td valign="top"><font face="Courier New, Courier, monospace" color="#777777" size="2px">' . $tekst . '</font><td><tr></table>';
}
?>
【问题讨论】:
-
你的
Doctype是什么?你能更具体地说明出了什么问题吗?iframe是否加载?有错误信息吗? -
尝试从 iframe 中移除 frameborder。告诉它是否有效@Jaap115
-
您能否发布生成的 HTML(在浏览器中,右键单击并“查看源代码”),而不是 PHP 代码?不是我看不懂php,而是我没有你说的include文件,所以无法测试。
-
在 IE 中我得到一条线而不是图片
-
顺便说一句,你知道
isset($_GET['id']) === true && empty($_GET['id']) === false和isset($_GET['id']) && !empty($_GET['id'])是一样的吗? (我猜你也许可以完全放弃对isset的检查,但我已经有一段时间没有使用 PHP 了。)