网页部分回显php脚本
我最近用LAMP安装了Fedora 20 VPS。从下面的输出可以看出,我的PHP工作正常: 我的问题是当我访问下面的页面时,php脚本被打印出来而不是被执行。如果一个“查看源代码”,那么整个代码都是可见的。 有人能帮帮我吗。下面是login.php的代码:网页部分回显php脚本,php,Php,我最近用LAMP安装了Fedora 20 VPS。从下面的输出可以看出,我的PHP工作正常: 我的问题是当我访问下面的页面时,php脚本被打印出来而不是被执行。如果一个“查看源代码”,那么整个代码都是可见的。 有人能帮帮我吗。下面是login.php的代码: <?php include 'init.php'; if(isset($_SESSION['admin'])){ header('Location: index.php'); } ?> <!DOCTYPE ht
<?php
include 'init.php';
if(isset($_SESSION['admin'])){
header('Location: index.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>Login - CPanel</title>
<link type="text/css" rel="stylesheet" href="libs/css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="libs/css/style.css" media="screen,projection"/>
</head>
<body>
<div class="container">
<div class="card publish-form-container">
<?php
if(isset($_POST['username'],$_POST['password'])){
$__USERS->adminLogin($_POST);
}
?>
<form class="col s12" method="POST" action="" >
<div class="input-field">
<input id="username-field" type="text" name="username">
<label for="username-field">Username...</label>
</div>
<div class="input-field">
<input id="password-field" type="password" name="password">
<label for="password-field">Password...</label>
</div>
<div>
<button class="btn waves-effect waves-light pull-right" type="submit">Login
<i class="mdi-content-send right"></i>
</button>
</div>
</form>
</div><!-- Post Card //-->
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="libs/js/materialize.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.materialboxed').materialbox();
});
</script>
</body>
</html>
登录-CPanel
用户名。。。
暗语
登录
$(文档).ready(函数(){
$('.materialbox').materialbox();
});
正如我在您的phpinfo页面中看到的:
short_open_tag Off Off
这意味着现在允许使用短open标记
因此,您在短标记
中放入的任何内容都不会被解析为PHP。您最好将其放在标准标记
块中。您的服务器未启用,因为有两种情况
short\u open\u tag=On
或使用htaccess启用它查看源代码显示可能与@CD001所说的内容基本相同,但仍在继续。基本上发生了什么。我更新了/etc/php,ini的short\u open\u tag=on并解决了问题。谢谢我用short\u open\u tag=On更新了/etc/php,解决了这个问题。谢谢