2011-02-24 160 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