模块:
class Model_Categories extends OrmModel
{
protected static $_connection = 'production';
protected static $_table_name = 'categories';
protected static $_primary_key = array('id');
protected static $_properties = array(
'id',
'name' => array(
'data_type' => 'varchar',
'label' => 'category name',
'form' => array(
'type' =>'text'
),
),
'image_location' => array(
'data_type' =>'text',
'label' =>'category image locartion',
'form' =>array(
'type'=>'text'
),
),
'timestamp' => array(
'data_type' =>'timestamp',
'label' =>'category image location',
'form' =>array(
'type'=>'timestamp'
),
),
);
}
当我尝试运行时
$model = Model_Categories::find('all');
它向我展示致命错误!ErrorException[致命错误]:在继承ArrayAccess:Unaught-Fuel\Core\PhpErrorException期间:Orm\Model::offsetExists($offset(的返回类型应与ArrayAccess::offetExists,或者#[\ReturnTypeWillChange]属性应用于暂时抑制C:\examplep\htdocs\qouter\fuel\packages\orm\classes\model.php中的通知:2536堆栈跟踪:#0 C:\examplep\tdocs\quter\fuel\core\bootstrap.php(8192,'返回类型…','C:\examplep\htdocs…',2536(#2 C:\examplep\tdocs\qouter\fuel\core\classes\autoloader.php(365(:include('C:\examplep\htdocs…](#3 C:\examplep\ htdocs\qouser\fuel \core\cclasses\autoloader.php(236(:fuel \core\autoloader::init_class app\classes\Model\classes.php(2(:燃料\核心\自动加载器::加载('Orm\Model'(#5C: \xamplep\htdocs\qouter\fuel\core\classes\autoloader.php(365(:include('C:\xamplep\tdocs…'(#6 C:\xamplep\ htdocs\ qouter\fuel\core\cclasses\autoloader.php(283(:fuel \ core \ autoloader::init_class ategorie…'(#8[内部函数]:controller_qoute->action_categories((#9 C:\examplep\htdocs\qouter\fuel\core\classes\request.php(483(:反射方法->invokeArgs(Object(Controller_Qoute(,Array(#10 C:\examplep\htdocs\qouter\public\index.php(133(:燃料\核心\请求->execute((#11 C:\examplep\htdocs\qouter\public\index.php(172(:{closure}((#12{main}
PKGPATH//orm/classes/model.php@第25行
有人知道怎么解决这个问题吗?
您使用的是PHP 8.1和不兼容的FuelPHP版本。
切换到1.9/dev分支,大部分是PHP 8.1。贬损问题在那里得到了解决。