2011-02-24 67 views
0

现在我正在处理一个非常奇怪而且相当简单的问题,大约2天。 我敢打赌,解决方案是显而易见的,但我只是不知道还有什么要做。PHP Kohana包含问题

我在Kohana框架中工作。 在我的C:/ wamp/www文件夹我有两个不同的网站:mysite1和mysite2。

所以我有FCKeditor的在mysite1现场工作包括这样的:

include(url::base(FALSE)."static/scripts/fckeditor/fckeditor.php"); -> include(mysite/web/admin/static/scripts/fckeditor/fckeditor.php)

和工程就像一个魅力!

好吧,我决定把FCKeditor的在mysite2,我用的是同样的命令.. ,它只是不工作,有一个埃罗消息:

没有这样的文件或目录..

我向你保证,在FCKeditor的

mysite2/web/admin/static/scripts/fckeditor/fckeditor.php

的完整路径(C:/wamp/www/mysite2/web/admin/static/scripts/fckeditor/fckeditor.php)存在路径包括作品。我只想得到include(url :: base(FALSE)。“static/scripts/fckeditor/fckeditor.php”)...

什么可能是错误的?

谢谢!

+0

你使用哪个版本的Kohana? (Ko2,Ko3.0,Ko3.1) – Ikke 2011-02-24 07:47:36

回答

0

如果完整路径工作正常,但使用url helper的路径不起作用,则可能是网站配置错误。

做任何你包括使用url::base工作?

看看你的页面输出,url::base(FALSE)."static/scripts/fckeditor/fckeditor.php"评估什么?

看看config.php,确保你的site_domain设置正确。

+0

是的url :: base works ..我有一些按钮是图像,我加载它们为href =“<?php echo url :: base。”/ static/icons /image.png“?>”,它工作得很好。它的像fckeditor文件夹是不可见的.. – mathew 2011-02-24 07:36:08

+0

错误是这样的: 检测到一个错误,防止加载此页面。如果问题仍然存在,请联系网站管理员。 C:/wamp/www/mysite2/app_admin/views/support/view_answer.php [22]: 包括(/mysite2/web/admin/static/scripts/fckeditor/fckeditor.php)[function.include] :无法打开流:没有这样的文件或目录 – mathew 2011-02-24 07:37:04

+0

还打开了site_domain:“mysite2/web/admin”。就像它应该是 – mathew 2011-02-24 07:38:09

3

当您需要包含文件时,可以使用find_file()方法。所以,你的代码看起来像

include Kohana::find_files("static", "/scripts/fckeditor/fckeditor"); 
+0

刚刚检查它..非常好!谢谢 – mathew 2011-02-24 09:26:32