我使用這個代碼來定義我的項目的目錄路徑:在PHP中使用未定義的常量,而generationg目錄路徑
的config.php是
<?php
define('CB_HOME', realpath(dirname(__DIR__)));
define('FD_HOME', CB_HOME."/testbot");
我用我在使用CB_home而FD_home其他文件。
我得到的錯誤:
PHP Notice: Use of undefined constant CB_HOME - assumed 'CB_HOME' in C:\\xampp\\htdocs\\test-bot\\testbot\\bootstrap.php on line 3
PHP Warning: require_once(CB_HOME/AbstractCbRest.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in C:\\xampp\\htdocs\\test-bot\\testbot\\bootstrap.php on line 3
PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'CB_HOME/AbstractCbRest.php' (include_path='.;C:\\xampp\\php\\PEAR') in C:\\xampp\\htdocs\\test-bot\\testbot\\bootstrap.php on line 3
我的bootstrap.php是:
<?php
require_once 'config.php';
require_once CB_HOME.'/AbstractCbRest.php';
它在哪兒去了?
和恆在'config.php'界定?你確定你正在查看* correct *'config.php'嗎? – deceze
嘗試在定義它之前連接FD家庭值。 – IEnumerable
我試過同樣的錯誤仍然存在相同的錯誤 – Shiven