首页 > 代码库 > fuelphp 问题1

fuelphp 问题1

fuelphp遇到的一些小问题,写下来以防止别人遇到相同的问题,写的比较随意

1.引用到orm\model 报错:class Model_Test extends Orm\Model

  报错内容:Class ‘Orm\Model‘ not found

  修正方法:fuel/app/config/config.php

把以下代码放开

‘always_load‘  => array(
         ‘packages‘  => array(
            ‘orm‘,
        ),
     ),

2.使用View_Smarty报错:View_Smarty::forge(‘XXXX‘)

  报错内容 Class ‘View_Smarty‘ not found

  修正方法:

  fuel/app/config/config.php加入代码

always_load  => array(         packages  => array(            orm,            ‘parser‘,        ),     ),    

  修正上面,继续报错:Class ‘Smarty‘ not found

  修正方法:

  下载Smarty包放在fuel/app/vendor目录下,并且在fuel/packages/parser/config/parser.php文件中配置

View_Smarty   => array(        ‘include‘ => APPPATH.‘vendor‘.DS.‘smarty‘.DS.‘smarty‘.DS.‘libs‘.DS.‘Smarty.class.php‘,        auto_encode   => true,        delimiters    => array(left => {, right => }),    ),

  详细内容要视具体目录结构配置

3.controller写法

  目录结构 fuel/app/classes/controller/user/test.php

  1-class写法:class Controller_User_Test extends Controller_Template

  2-$template声明:public $template = ‘test/test1/test2‘;    // 位置:fuel/app/views/test/test1/test2.php

    test2的后面省略.php 不然会报错

 

fuelphp 问题1