我是一名法国开发人员,很抱歉我的英语不好。
在我的网站上插入多种语言的数据时出现问题。我说我的 i18n 表是从控制台创建的,并以它可以工作的单一语言插入!
这是错误:
数据库错误
错误:SQLSTATE [42S22]: Column not found: 1054 Unknown column 'Array' in 'field list' SQL Query: INSERT INTO ` expandingCakePHP. Accesses
( name
) VALUES (Array) 注意:如果要自定义此错误消息,请创建应用程序/视图/错误/pdo_error.ctp
我的 admin_add.ctp(文件查看/访问)
foreach (Configure :: read ('Config.languages') as $lang) {
echo $this-> Form-> input ('Access.name.'. $lang, array ('label' => __ ('Name'). '(. $lang.') '));
}
我的 access.php(模型文件)
var $actsAs = array (
'Translate' => array (
'name' => '_name'
)
);
我的 AccessesController.php(控制器文件夹)
admin_add public function () {
if ($this-> request-> is ('post')) {
$this-> Access-> create ();
$this-> Access-> locale = Configure :: read ('Config.languages');
if ($this-> Access-> save ($ this-> request-> data)) {
$this-> Session-> setFlash (__ ('The access has been saved'), 'notif');
$this-> redirect (array ('action' => 'index'));
}
else {
$this-> Session-> setFlash (__ ('The Access Could not be saved. Please, try again.'), 'notif', array ('type' => 'alert-error'));
}
}
}
在我的 bootstrap.php (配置文件)
Configure :: write ('Config.languages', array ('eng', 'eng'));
Configure :: write ('Config.language', 'eng');
Configure :: write ('App.encoding', 'utf-8');
邮寄表格收到的结构是否正确?/app/Controller/AccessesController.php(第46行)
array (
'Access' => array (
'name' => array (
'eng' => 'title',
'eng' => 'title'
)
)
)