我已经在 php 中编写了函数
function siteContent() {
$path = array();
$strDefaultPath = '/sites/';
$_SERVER['PATH_INFO'] = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : $strDefaultPath;
$path = explode( '/', substr( $_SERVER['PATH_INFO'], 1) );
if(file_exists('/'.$path['0'].'.php')) {
require_once('/'.$path['0'].'.php');
} else {
require_once('sites/main.php');
}
}
它不起作用
在菜单链接中看起来像这样http://site.com/subsite/ 但是包含子站点内容的文件的路径看起来像这样 public_html/sites/subsite.php
我可以用这个函数重写 url 或
我如何仅在 php 中重写或构建该 url
我是 php 的初学者