In joomla iam using this php code to get language prefix in joomla :
$lang = substr(JFactory::getLanguage()->getTag(), 0,2)
What this code do is extract prefix languages :
es
fr
en
it
I need to add something to this code so if the extracted = en remove it
如果您在无条件的情况下在一行中使用它:
$lang = str_replace('en', '', substr(JFactory::getLanguage()->getTag(), 0, 2));
Why not add an if then else statement after it is called?
$lang = substr(JFactory::getLanguage()->getTag(), 0,2);
if ($lang = "en")
{
$lang = "";
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.