在大多数情况下,纯URL会被这样识别并自动链接: 该错误仅出现在localhost上,请帮忙!
有趣的是,在托管服务器上,它可以完美运行...
require_once('header.php');
// Preventing the direct access of this page.
if(!isset($_REQUEST['slug']))
{
header('location: index.php');
exit;
}
else
{
// Check the page slug is valid or not.
$statement = $pdo->prepare("SELECT * FROM tbl_page WHERE page_slug=? AND status=?");
$statement->execute(array($_REQUEST['slug'],'Ativo'));
$total = $statement->rowCount();
if( $total == 0 )
{
header('location: index.php');
exit;
}
}
$statement = $pdo->prepare("SELECT * FROM tbl_page WHERE page_slug=?");
$statement->execute(array($_REQUEST['slug']));
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row)
{
$page_name = $row['page_name'];
$page_slug = $row['page_slug'];
$page_content = $row['page_content'];
$page_layout = $row['page_layout'];
$banner = $row['banner'];
$status = $row['status'];
}
// If a page is not Ativo, redirect the user while direct URL press
if($status == 'Inativo')
{
header('location: index.php');
exit;
}