Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 joomla iam 中,使用此 php 代码在 joomla 中获取语言前缀:
$lang = substr(JFactory::getLanguage()->getTag(), 0,2)
这段代码所做的是提取前缀语言:
爱 它 _ _
我需要在这段代码中添加一些东西,所以如果提取的 = en 删除它
如果您在没有条件的情况下在一行中需要它:
$lang = str_replace('en', '', substr(JFactory::getLanguage()->getTag(), 0, 2));
为什么不在调用后添加 if then else 语句?
$lang = substr(JFactory::getLanguage()->getTag(), 0,2); if ($lang = "en") { $lang = ""; }