今天,我们使用一个开关来让我们的网站工作。
switch (key($_GET)) {
case 'index': include('assets/pages/index-page.php'); break;
case 'faq': include('assets/pages/faq-page.php'); break;
...
}这意味着URL是https://finna.nu/?index,但我们希望它是:https://finna.nu/page/index
我们如何在PHP中做到这一点?我们还可以使用现有的交换机吗?
发布于 2017-08-29 17:42:40
你当然可以做到。在switch语句中使用pathinfo()来获取页名称后面的额外路径。
https://stackoverflow.com/questions/45935562
复制相似问题