Php 在codeIgniter中包含来自外部脚本的控制器文件
我有以下目录结构Php 在codeIgniter中包含来自外部脚本的控制器文件,php,codeigniter,uploadify,Php,Codeigniter,Uploadify,我有以下目录结构 application | | -----> controller | | ------> profie_control.php assets | | ------> Others | |---> uploadify | | --> uploadify.php
application
|
| -----> controller
|
| ------> profie_control.php
assets
|
| ------> Others
|
|---> uploadify
|
| --> uploadify.php
现在,在我的uploadify.php
中,我正在做我想执行的所有事情。然后在所有事情完成后,我想调用一个函数,并在profile\u control.php
中向它传递数据。现在我不知道如何访问这些函数。
我尝试使用以下代码
include_once("http://localhost/php/ci/index.php/profile_control/myfunction");
在uploadify.php
中,它给出了以下错误
Warning: include_once() [function.include-once]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:\wamp\www\php\ci\assets\Others\uploadify\uploadify.php on line 8
我在一些论坛上读到,这种方法不好,因为它可能会导致安全问题。现在,我如何安全地将数据从
uploadify.php
发送到profile\u control.php
,或者什么是更好的选择???您不能按URL包含/要求,但可以按路径包含/要求,这就是您想要做的。在控制器中:
include_once("../../assets/Others/uploadify/uploadify.php");
some_func(); // function from file 'uploadify.php'
这样做安全吗?是的,没有更好的方法。最好是
require_once
而不是include_once
,但这是另一回事。我尝试了你的建议,但它给了我错误。它说它找不到我在profile_control类中继承的codeIgniter的CI_控制器。