2011-07-12 68 views
3

我想包括一個名爲includes.php的PHP文件,它不包含在正常的Views文件夾中。該文件包含指向要用這個特定主題加載的JS文件的鏈接。 includes.php駐留在scripts文件夾中:無法加載請求的文件 - CodeIgniter

| assets | 
     | themes 
        | theme_name 
           | css 
           | img 
           | scripts 
| application 
| system 

在我控制我使用$this->load->helper('url')總是正常工作,並在視圖中我試圖調用如下

$includes_url = asset_url() . 'themes/' . $theme . '/scripts/includes.php'; 
$this->load->file($includes_url); 

的URL看起來正確的時候,我回聲$includes_url路徑是好的。

儘管這樣,我得到了錯誤:

An Error Was Encountered 
Unable to load the requested file: includes.php 

什麼其他問題可能會有除了代碼點火器沒有找到與文件路徑的文件?我錯過了明顯的東西嗎?

+0

你確定什麼permissons夠了嗎? ps chmod 777 -R/var/www/ – NiLL

+0

是的,它們設置爲744. –

+0

可以試試使用base_url()。'assets/themes'。$ theme。'/ scripts/includes.php'? – NiLL

回答

3

我想你使用的是與codeigniter .htaccess文件,這導致你在獲取你想包括的PHP文件的確切路徑的問題。 使用包含包含文件的PARENT文件夾的名稱在下面的代碼中重命名單詞庫,然後使用現有的.htaccess文件更新它。

 
RewriteEngine on 
RewriteCond $1 !^(index\.php|library|user_guide|robots\.txt) 
RewriteRule ^(.*)$ index.php/$1 [L] 
+0

我不確定就是這樣,否則我將無法訪問文件夾中的任何其他文件? –

相關問題