试图构建基于模板的php时,GET和POST出现问题
我正在构建我的第一个真正的php web应用程序。正如许多人所知,这需要构建大量的页面 为了简化重复的内容,我将大部分内容放在content.php页面中,如下所示试图构建基于模板的php时,GET和POST出现问题,php,Php,我正在构建我的第一个真正的php web应用程序。正如许多人所知,这需要构建大量的页面 为了简化重复的内容,我将大部分内容放在content.php页面中,如下所示 <?php include_once ('config3.inc');?> <?php if(isset($_GET['p'])){ $page = $_GET['p']; }else { $page =''; } ?> <!DOCTYPE html> <html xmln
<?php include_once ('config3.inc');?>
<?php if(isset($_GET['p'])){
$page = $_GET['p'];
}else {
$page ='';
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $_SERVER['PHP_SELF'];?></title>
<?php include('styles.inc');?>
<?php include('api.inc'); ?>
<?php include('scripts.inc');?>
</head>
<body>
<div id="container">
<?php include ('header.inc');?>
<div><!-- Content -->
<?php include ('./content/'.$page);?>
</div>
</div><!-- end container -->
<!-- Footer -->
<?php include ('footer.inc');?>
</body>
</html>
这样,当我想调用一个页面时,我会转到www.domain.com/content.php?p=pagename.php,它会将所有内容“包装”到正确的样式表容器和页脚中,等等
在我开始制作需要使用POST数据的CRUD页面之前,它一直工作得很好
有更好的方法吗?或者我需要完全放弃这种方法吗?最好问同样的问题@Thank you,我也在那里发布了。我开始在那里读一些帖子,对我忽略的所有事情感到害怕。哎呀!