我在开发过程中使用以下内容来定义 root:
define('LOCAL_URL', 'http://localhost/~xampp/Mysite');
define('REMOTE_URL', 'http://example.com');
define('DEV_VERSION', true);
if(DEV_VERSION)
define('URL', LOCAL_URL);
else
define('URL', REMOTE_URL);
这个概念对我来说是新的,我是一个 PHP 初学者,所以请保持温和。
我正在尝试在“require_once”中使用“URL”,但我似乎无法让它工作(因为不包括所需的文件)。我尝试了以下方法:
require_once URL.'/phpincludes/coming-events.php';
require_once(URL.'/phpincludes/coming-events.php');
require_once URL . '/phpincludes/coming-events.php';
require_once (URL . '/phpincludes/coming-events.php');
require_once(URL.'phpincludes/coming-events.php');
我检查了http://www.php.net/manual/en/function.require-once.php并在 Stackoverflow 上进行了搜索,但我并没有真正取得任何进展。
我确定这是我在这里犯的一个非常愚蠢和基本的错误,但我很茫然,非常感谢一些帮助!