我有一个目前用英语的网站; 我希望能够在用户点击其他语言时切换到其他语言(网站上有很少的国家/地区标志图标).我目前正在尝试的方式是使用数组,例如:
$english = array('index',
array('h1' => 'this is some h1 text',
'h2' => 'this is some h2 text'));
$japanese = array('index',
array('h1' => '????????',
'h2' => ??????'));
print $english[index][h1];
print $japanese[index][h2];
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,如果我使用单独的语言为每个页面执行此操作,那将是一个疯狂的代码量.我可以尝试其他什么方法?