PHP Fatal error: Class 'Collator' not found despite PHP 5.3.24

北城以北 提交于 2021-02-10 12:55:12

问题


my output after code below is: "PHP Fatal error: Class 'Collator' not found".

I've read in php manual that for COLLATOR class, PHP version needs to be PHP 5 >= 5.3.0. My PHP version is 5.3.24.

in my phpinfo() I searched 'coll' string but nothing is found.

also please note that my site lang is Turkish and I am using UTF-8

So what is the reason for my fatal error output? Thanks.

/* fetch values */
$etiket_bulutu = '';
while ($beyan->fetch()) 
{
    $etiket_bulutu .=  $tags.', ';
}

$etiket_bulutu = substr_replace($etiket_bulutu ,'',-2); //omit last {, } chars

$etiketler = explode(", ", $etiket_bulutu); //get each tag as arr

$etiketler = array_unique($etiketler);
$etiketler = array_values($etiketler); //only unique tags without NULLs

$etadet = count($etiketler);

$coll = collator_create('tr_TR'); //from http://www.php.net/manual/en/collator.sort.php
collator_sort($coll, $etiketler);

for($x=0;$x<$etadet;$x++)
 {
  echo $etiketler[$x];
  echo "<br />";
 }

回答1:


In the manual, note that the class is part of the intl extension. See the Installation Instructions for intl and note that it needs to be explicitly installed using --enable-intl and/or may require the ICU library, depending on the system. Check your PHP installation whether intl is installed or not.



来源:https://stackoverflow.com/questions/20658399/php-fatal-error-class-collator-not-found-despite-php-5-3-24

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!