问题
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