在从 2.6 迁移到 3.1 期间,可能会遇到在克罗地亚语中显示特殊字符的问题。内容取自数据库。
内容通过 CakePHP 2.x 应用程序存储在数据库中,并且可以正确显示。但是当我连接一个新的应用程序时,我无法正确显示这些字符 čćšđž。
数据库/表: MyISAM utf8_general_ci
cakephp 2.x 应用程序
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => '*********',
'password' => '************',
'database' => 'apartmani',
);
核心.php
/**
* Application wide charset encoding
*/
Configure::write('App.encoding', 'UTF-8');
引导程序.php
Configure::write('Config.language', 'hrv');
cakephp 3.1- rc1
'App' => [
'namespace' => 'App',
'encoding' => 'UTF-8',
...
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
//'port' => 'nonstandard_port_number',
'username' => '*********',
'password' => '***********',
'database' => 'apartmani',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
引导程序.php
/**
* Set the default locale. This controls how dates, number and currency is
* formatted and sets the default language to use for translations.
*/
ini_set('intl.default_locale', 'hr');
如何解决这个问题?