我有一些带有 session_start() 函数的 PHP 文件和一些 cookie 参数的设置。它们是纯 PHP 页面,根本没有 HTML。现在我想在这些 PHP 页面中添加一些背景颜色和一些表单和表格。当我添加任何一点 HTML 时,它会给我“标题已通过”的错误!
我想知道嵌入PHP和HTML的正确方法!请告诉我。
这是代码:
<?php
include 'functions.php';
secure_session_start();
define("HOST", "localhost"); // The host you want to connect to.
define("USER", "admin"); // The database username.
define("PASSWORD", "password"); // The database password.
define("DATABASE", "test"); // The database name.
$mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);
if(isset($_POST['name'], $_POST['password'])) {
$name = $_POST['name'];
$password = $_POST['password']; // The hashed password.
if(login($name, $password, $mysqli) == true) {
// Login success
echo 'Success: You have been logged in!';
} else {
// Login failed
echo 'Wrong ID/password!';
}
} else {
// The correct POST variables were not sent to this page.
echo 'Invalid Request';
}
?>