【发布时间】:2026-01-14 08:20:02
【问题描述】:
以下代码在我网站的index.php 文件中,每次查询我网站上的页面时都会运行。这两个requires 都在那里执行各自的404 错误页面,所以不用担心。在 php 中执行此操作的最高效的方法是什么?
$cache = $_SERVER['REQUEST_URI'];
if(preg_match('/^\/blog/',$cache) || preg_match('/^\/portfolio/',$cache)){
define('WP_USE_THEMES', true);
// Loads the WordPress Environment and Template
require('./wordpress/wp-blog-header.php');
}else{
// Load codeigniter
require('./codeigniter/index.php');
}
【问题讨论】: