在另一个网站中包含代码段代码 [英] Including a codeigniter snippit in another site
本文介绍了在另一个网站中包含代码段代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在现有非CI网站的所选网页中加入CI评论表单。我已尝试使用
I would like to include a CI comment form in selected pages in an existing non CI site. I’ve tried using
$_SERVER["REQUEST_URI"] = "cms/2";
//Set GET action,method params etc
require_once "path/to/index.php";
当我将上述代码包含在codeigniter根目录外的文件中时,得到
When I include the above code in a file outside the codeigniter root I get
您的系统文件夹路径没有正确设置
。请
打开以下文件并更正
this:index.php
Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php
任何想法?感谢
推荐答案
这是一个相对路径问题。包含的文件显然使用调用函数的路径。我只需要包含
It was a relative path problem. The included file obviously uses the path of the calling function. I just needed to include
$application_folder = dirname(__FILE__)."/application";
$system_path = dirname(__FILE__)."/system";
in index.php
in index.php
这篇关于在另一个网站中包含代码段代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文