【问题标题】:Including a codeigniter snippit in another site在另一个站点中包含一个 codeigniter 代码段
【发布时间】:2011-07-08 03:00:05
【问题描述】:

我想在现有非 CI 站点的选定页面中包含 CI 评论表单。我试过使用

$_SERVER["REQUEST_URI"] = "cms/2";

//Set GET action,method params etc

require_once "path/to/index.php";

当我将上述代码包含在 codeigniter 根目录之外的文件中时,我得到

您的系统文件夹路径不 似乎设置正确。请 打开以下文件并更正 这个:index.php

有什么想法吗?谢谢

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    这是一个相对路径问题。包含的文件显然使用了调用函数的路径。我只需要包含

    $application_folder = dirname(__FILE__)."/application";
    $system_path = dirname(__FILE__)."/system"; 
    

    在 index.php 中

    【讨论】:

      猜你喜欢
      • 2015-12-08
      • 2011-01-29
      • 2013-08-11
      • 2011-10-06
      • 1970-01-01
      • 2013-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多