Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
203 views
in Technique[技术] by (71.8m points)

php - Can not load contact page

This is index file for my website. I want to load contact page but it doesn't work. How can I do with my code. Thank you

<?php 
$Page = (isset($_GET["p"]));

include('includes/header.php');

if ($Page == "contact"){
    include('pages/contact.php');
} else {
    include('pages/home.php');
}

include('includes/footer.php');?>
question from:https://stackoverflow.com/questions/65950697/can-not-load-contact-page

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

isset results a boolean value, so $Page would be true

Try this: $Page = isset($_GET["p"]) ? $_GET["p"] : null; Or $Page = $_GET["p"] ?? null;


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...