Is it feasible to rely on setlocale, and rely on locales being installed?

后端 未结 3 753
走了就别回头了
走了就别回头了 2020-12-19 05:46

I was trying to generate a localized date string with strftime, the placeholder I use is %x. The language/locale is setlocale(LC_ALL, array(\

3条回答
  •  Happy的楠姐
    2020-12-19 06:07

    You can check the return value of setlocale and at least check that it was installed. Otherwise you will have silent failures:

    setlocale(LC_ALL, 'en_US') or die('Locale not installed');
    

提交回复
热议问题