开发者

Include config file using url?

开发者 https://www.devze.com 2023-04-02 06:27 出处:网络
I have struggled with including config file in php. i have a config.php file in TAA/system/application/config but i need to include that config file to my local.php presented in TAA/ so i did this but

I have struggled with including config file in php. i have a config.php file in TAA/system/application/config but i need to include that config file to my local.php presented in TAA/ so i did this but it throw error message.

  1. http:// wrapper is disabled in the server configuration by allow_url_include=0

  2. failed to open stream: no suitable wra开发者_如何学运维pper could be found

i include the config file using include("http://baseurl/TAA/system/application/config/config.php");


Don't specify the http: protocol. That will just make PHP request the file using HTTP. You also have allow_url_include disabled in php.ini.

Instead, use include __DIR__ . '/system/application/config.php';

If you are using < 5.3, then replace __DIR__ with dirname(__FILE__).

0

精彩评论

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