【问题标题】:How to use philsturgeon codeigniter assets?如何使用 philsturgeon codeigniter 资产?
【发布时间】:2011-06-23 08:38:52
【问题描述】:

我尝试在我的项目中使用philsturgeon CI assets 并遇到此错误:

PHP 致命错误:在第 6 行的 /var/www/html/staging/psms_dev/application/views/login.php 中调用未定义函数 css()

我使用的代码是:

<?php echo css('style.css'); ?>

这是我的文件夹结构:

application  
system  
assets  
--css  
--js  
--images  

这是我的 assets.php 配置

$config['asset_dir'] = '/assets/';
$config['asset_url'] = config_item('base_url').'assets/';

我使用 CodeIgniter 2.0.2。希望大家能帮忙。谢谢。

【问题讨论】:

    标签: php codeigniter assets


    【解决方案1】:

    /assets/ 是否应该在您服务器的根目录中?如果是这样,您需要对其进行 chmod,因为根目录上的文件夹通常受到限制。如果没有,那么您可能需要去掉'/assets/' 中的第一个正斜杠

    【讨论】:

    • 谢谢。还有一个似乎我忘了自动加载助手。
    【解决方案2】:

    尝试从/assets/ 中删除前导/

    $config['asset_dir'] = 'assets/';
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多