溢出社区有史以来第一个帖子!
目前我正在做一个项目,并开始使用 PHP 来动态插入页面。
在这个时间点我有...
switch ($route) {
case 'step1':
include('./views/enrolment/mainstream/_step1.php');
include('./views/partials/_footer.php') ;
break;
case 'step2':
include('./views/enrolment/mainstream/_step2.php');
include('./views/partials/_footer.php') ;
break;
case 'step3':
include('./views/enrolment/mainstream/_step3.php');
include('./views/partials/_footer.php');
break;
case 'step4':
include('./views/enrolment/mainstream/_step4.php');
include('./views/partials/_footer.php');
break;
case 'step5':
include('./views/enrolment/mainstream/_step5.php');
include('./views/partials/_footer.php');
break;
case 'step6':
include('./views/enrolment/mainstream/_step6.php');
include('./views/partials/_footer.php');
break;
case 'step7':
include('./views/enrolment/mainstream/_step7.php');
include('./views/partials/_footer.php');
break;
这意味着似乎非常长,并且通过 for 循环更好地实现,但是我是 PHP 的新手,完全不确定我将如何实现这个想法。
也欢迎任何其他不使用 for 循环的建议!
多谢你们!