How do I use the require_once
php function in Codeigniter on a normal PHP file? I', currently getting an error.
Code:
require_once($_SERVER['DOCUMENT_ROOT'].'/php/jformer.php');
Error:
Message: require_once() [function.require-once]: http:// wrapper is disabled in the server configuration by allow_url_include=0
Message: require_once(http://localhost/site/php/jformer.php) [function.require-once]: failed to open stream: no suitable wrapper could be found
You don't use $_SERVER['DOCUMENT_ROOT']
for this, you want to use APPPATH
or BASEPATH
instead, or just type the full path to the file. require_once
should be passed a local file, not a URL.
You should be using the path to the file and not the URL. Best (and certainly CI friendly) way would be to use BASEPATH
or APPPATH
constants.
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