1.正则不支持/e模式
如果用/e模式,会抛出以下异常信息:PHP Warning 'yii\base\ErrorException' with message 'preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead'
in E:\project\basic\extensions\html_safe\HTML_Safe.php:356
可以改为:$tempval = preg_replace('/(\d+);?/me', "chr('\\1')", $value);
//可以改为:
$tempval = preg_replace_callback('/(\d+);?/m', function($matches){
return chr($matches[1]);
}, $value);
2、发送邮件报错
如果用ssl加密的端口,会报以下错误:
Exception 'Swift_TransportException' with message 'Connection could not be established with host mail.daixiaorui.com [ #0]'
解决办法:
1、将port改为25;
2、注释“encryption”。
完整配置如下:'mailer' => array(
'class' => 'yii\swiftmailer\Mailer',
'transport' => array(
'class' => 'Swift_SmtpTransport',
'host' => 'mail.daixiaorui.com',
'username' => 'test@daixiaorui.com',
'password' => '************',
'port' => '25',
// 'encryption' => 'ssl'
),
'messageConfig'=>[
'charset'=>'UTF-8',
'from'=>['test@daixiaorui.com'=>'test']
]
),
3、附加一点:以下写法不支持(不过这不属于yii框架本身的问题)
$dealAfterObj->$dealCallbackAfter[1]($param);
解决办法://将以下
$dealAfterObj->$dealCallbackAfter[1]($param);
//改成
$dealFuncName = $dealCallbackAfter[1];
$dealAfterObj->$dealFuncName($param);