开发者

Using require_once in Codeigniter

开发者 https://www.devze.com 2023-03-20 21:48 出处:网络
How do I use the require_once php function in Codeigniter on a normal PHP file? I\', currently getting an error.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号