0

我想通过 iframe 显示一个文本文件,但它在 IE 中不起作用。它在 Mozilla Firefox 中运行良好。有任何想法吗?

下面是我的代码:

<!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/plain; charset=ANSI" />
</head>
<body>

<iframe src='http://localhost/button3.txt'
 scrolling='no' frameborder='0'
 style='border:none; width:1300px; height:500px'></iframe>

</body>

</html>

button.txt 包含用 php 编写的脚本。而不是显示它执行它的脚本。

4

1 回答 1

0

我是 PHP 初学者。以下答案基于我在搜索时发现的内容:

将 IFrame 的 src 设置为 PHP 文件

<iframe src='http://localhost/showTxt.php' scrolling='no' frameborder='0' style='border:none; width:1300px; height:500px'></iframe>

显示文本.php

1.

<?php
echo file_get_contents("test.txt");
?> 

或者

2.

<?php
$output=file_get_contents("test.txt");
highlight_string($output);
?> 
于 2014-01-03T12:29:43.617 回答