我有一个名为 theme.php 的语言文件,在这个文件中有一行
$LANG['sources_HAVE_AN_ACCOUNT'] = "Have an account?";
现在在名为 votes.php 的文件中,我正在使用代码:
if($r) //voting done
{
echo "". $LANG['sources_HAVE_AN_ACCOUNT']." <a href='../login' target='_blank' #0087F7; text-decoration: none; font-weight: bold;'>".$LANG['header_LOGIN_title']."</a>";
}
elseif(!$r) //voting failed
{
$effectiveVote = getEffectiveVotes($id);
echo $effectiveVote." ".$LANG['sources_POINTS_title'];
}
允许用户在特定文章中进行投票。
问题是,当您点击投票按钮时,文本“有帐户吗?”没有出现!!
为什么会这样?问题出在哪里?
最佳答案
要检查的几件事:
- 您的
theme_lang.php
文件必须位于application/language/english/
- 将
theme
添加到位于application/config/autoload.php
的$autoload['langage']
数组中 - 检查 application/config/config.php 您的
$config['language']
是否设置为english
然后,要在 votes.php Controller 中使用翻译,请使用:
$this->lang->line('sources_HAVE_AN_ACCOUNT');
您可以在 Language Class documentation 中找到更多信息代码点火器
关于php - Codeigniter Framework 中的语言问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24780046/