I'm using the following to define root while in development:
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);
This concept is new to me and I'm a bit of a PHP beginner so please be gentle.
I'm trying to use 'URL' in 'require_once' and I can't seem to get it to work (as in the required file is not included). I've tried the following:
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');
I've checked http://www.php.net/manual/en/function.require-once.php and have searched on Stackoverflow and I'm not really making any headway at all.
I'm sure it's a really stupid and basic error I'm making here, but I'm at a loss and would really appreciate some help!
The problem is probably because URL
has a protocol, and it is trying to open the file over HTTP.
Including files remotely is disabled by default in PHP (allow_url_include
), and for good reason.
You should be passing relative or absolute paths to files in your filesystem to be included.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With