【发布时间】:2017-04-28 10:12:22
【问题描述】:
我正在尝试将 php 文件的内容显示到 div。
<div contenteditable="true" id="highlight">
<?php
echo file_get_contents( "/path/test.php" );
?>
</div>
test.php
<?php
require_once (lib.php');
/*
some comments here
*/
session_cache_limiter('private, must-revalidate');
header('Pragma: public');
@ob_start();
@session_start();
error_reporting(E_ALL);
ini_set('display_errors', '1');
// INCLUDES
define('FPDF_FONTPATH', "path/font/");
// print_r($_GET);
?>
.......................
但 div 中的内容仅从这一行显示:// print_r($_GET);。我需要显示文件的全部内容。
谁能帮我解决这个问题?提前致谢。
【问题讨论】:
-
你在浏览器中查看源代码了吗?
-
提示:
highlight_file()php.net/manual/en/function.highlight-file.php -
开头的
<?php标记被视为HTML 标记(在div 内)。 -
@JustOnUnderMillions..检查了源代码。那里显示了内容,但那些缺少的行以绿色显示。
-
@JustOnUnderMillions ..实际上我需要保存可编辑 div 上显示的文件内容。但是如果我使用
highlight_file,它将返回内容以及高亮样式。有没有办法避免这种情况?
标签: php html file-get-contents