是否有特定的智能功能按字母顺序排列数组?

I'm using a smarty template for a multi-language website. I got an array of country that is order by country code, which is ok for the english version as country name are in the right order but no ok for other languages (for example United Kingdom stay in the "U" whereas in French it prints "Royaume Uni".

Is there a smarty function to order an array alphabetically?

You need to sort the before assigning it in smarty as such:

asort($countryList);
$smarty->assign($countryList);

Use:

You can apply a modifier to an array in Smarty like this (the @ prefix means the modifier is applied to the whole array, not each element):

$array|@some_modifier

asort() won't work as a modifier however, because it modifies the passed array and returns a boolean rather than returning a modified array. You could however define your own function and use that as a modifier, e.g.

function sort_array($array) {
    asort($array);
    return $array;   
}

Then in Smarty you can do something like

{foreach from=$array|@sort_array item=val}
    {$val}
{/foreach}