0

嗨,我的脚本(https://github.com/joshf/Indication/issues/6)报告了一个关于 echo 语句打印而不是执行的问题

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Indication</title>
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="resources/bootstrap/css/bootstrap.css" type="text/css" rel="stylesheet">
<style type="text/css">
body {
    padding-top: 60px;
}
</style>
<link href="resources/bootstrap/css/bootstrap-responsive.css" type="text/css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<!-- Nav start -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">Indication</a>
</div>
</div>
</div>
<!-- Nav end -->
<!-- Content start -->
<div class="container">
<div class="page-header">
<h1><? echo WEBSITE; ?></h1>
</div>      
<div class="alert alert-error"><h4 class="alert-heading">Error</h4><p>ID cannot be blank.</p><p><a class="btn btn-danger" href="javascript:history.go(-1)">Go Back</a></p></div></div></body></html>

注意回声网站

PHP代码是

  die("<div class=\"alert alert-error\"><h4 class=\"alert-heading\">Error</h4><p>ID does not exist.</p><p><a class=\"btn btn-danger\" href=\"javascript:history.go(-1)\">Go Back</a></p></div></div></body></html>");

!这是代码问题还是配置问题,我无法重现

4

2 回答 2

2

这可能是因为您使用的是 php 短标签<?..?>。请避免使用它们并切换到长的<?php....?>

于 2013-05-30T18:59:12.330 回答
1

可能您已关闭服务器中的短标签。

使用它不是一个好主意

<? /* something */ ?>
<?=echo $something;?>

因为在某些服务器中短标签被禁用。

尝试:

<?php echo WEBSITE; ?>
于 2013-05-30T18:59:54.687 回答