我正在创建一个php前端控制器,因为我需要包含其他文件夹中的文件,而不是为那些具有相同内容的文件创建相同的文件
目录结构示例
rome
- index.php
- detail.php
- show.php
另一个文件夹
london
- index.php (same content as rome/index.php folder)
- detail.php (different content as rome/detail.php folder)
- show.php (same content as rome/show.php folder)
然后,london文件夹必须只包含与rome / detail.php和" index"不同内容的detail.php。并且"显示"必须从罗马文件夹
加载这是我的htaccess /前端控制器
的.htaccess
RewriteEngine On
RewriteRule . /front-controller.php [L]
前Controller.php这样
path = "{$_SERVER['DOCUMENT_ROOT']}$_SERVER['REQUEST_URI']}";
if (! file_exists ($path) ) include str_replace("london" , "rome" , $path );
现在我对包含其他内容的文件有问题......
例如,我的rome / index.php有
include 'content/header.php'
当我加载london / index.php时出现错误
'content/header.php' failed to open stream: No such file or directory
编辑
这些是错误
Warning: require(content/php/config.php): failed to open stream: No such file or directory in /home/debian/www/rome/content/php/start.php on line 17
Fatal error: require(): Failed opening required 'content/php/config.php' (include_path='.:/usr/share/php:/usr/share/pear:') in /home/debian/www/rome/content/php/start.php on line 17