我想使用内容表,其中包含所有翻译值。在laravel 4中,我们有一个包含以下脚本的语言文件:
return array(
"password" => "Passwords must be at least six characters and match the confirmation.",
"user" => "We can't find a user with that e-mail address.",
"token" => "This password reset token is invalid.",
"sent" => "Password reminder sent!",
);
我用foreach用以下脚本创建这个数组:
$array = DB::table('Content_BO_Reminder')->get();
$returnarray = array();
foreach ($array as $value) {
$returnarray[] = '
\''.$value->key.'\' => \''.$value->value_en.'\',
';
}
return $returnarray;
但是当我尝试调用以下函数时{{trans('reminder.password')}}的结果是提示。密码。
任何人都有想法?提前致谢
答案 0 :(得分:1)
试试这个:
foreach ($array as $value) {
$returnarray[$value->key] = $value->value_en;
}