这是我配置文件中的内容:
define('BASE_DIR', str_replace('\\', '/', realpath(dirname(__FILE__))) . '/', false);
// output: C:/xampp/htdocs/myweb/
define('BASE_URL', $protocol . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\\') . '/', false);
//output: http://localhost/myweb/
define('APP_DIR', BASE_DIR . 'app/', false);
// output: C:/xampp/htdocs/myweb/app/
define('TEMP_DIR', BASE_DIR . 'app/view/template/', false);
//output: C:/xampp/htdocs/myweb/app/view/template/
define('LIBRARY_DIR', BASE_DIR . 'library/', false);
//output: C:/xampp/htdocs/myweb/library/
define('SYSTEM_DIR', BASE_DIR . 'system/', false);
//output: C:/xampp/htdocs/myweb/system/
我将上述文件包括在索引文件中,然后包括一个文件初始化。类似php
指数php
// Include the config file. If file not found throw error and exit.
if (!file_exists('config.php')) {
header('Location: error/404.php');
exit();
} else {
include_once 'config.php';
}
// Load startup file to check, set environment plus a few core files
require_once SYSTEM_DIR . 'initialize.php';
初始化。php执行一些检查并设置应用程序所需的一些参数。
这很好,但最近我切换到PhpStorm,IDE说
无法解析表达式的目标
'str_replace('\\', '/', realpath(dirname(__FILE__)))/system/initialize.php'
(第27行)。
这是什么问题?如果表达式的目标没有按照IDE解析,那么它如何仍然包含初始化文件。