@PHPJAVAGOC [#2楼](#comment2) 您好,您需要更改配置,
譬如Url的更改:
'url' => [
'class' => 'fecshop\services\Url',
'showScriptName'=> true, // if is show index.php in url. if set false ,you must config nginx rewrite
'randomCount'=> 8, // if url key is exist in url write table , add a random string behide the url key, this param is define random String length
// 子服务
'childService' => [
'rewrite' => [
'class' => 'fecshop\services\url\Rewrite',
'storage' => 'RewriteMongodb',
],
'category' => [
'class' => 'fecshop\services\url\Category',
],
],
],
将 'storage' => 'mongodb',
改成 'storage' => 'RewriteMongodb',
原因是:之前的设置方式,扩展不是很方便,因此进行了调整,除了调整url,你还需要调整其他的,你可以参看我这次提交的代码:https://github.com/fecshop/yii2_fecshop/commit/938e2b9ee2d37df24bd90cd821f96f31d594eeec
涉及到好几个services的改动,您把配置改一下就可以了,
那么,如何改呢?以url为例,打开文件夹:https://github.com/fecshop/yii2_fecshop/tree/master/services/url/rewrite
可以看到下面有 RewriteMysqldb.php
RewriteMongodb.php
, 那么您将mongodb
改成RewriteMongodb
,就可以了,也就是文件名部分,大小写要一致。
除了url rewrite,product, category, cms page, 等,具体看 这次代码提交涉及到services:https://github.com/fecshop/yii2_fecshop/commit/938e2b9ee2d37df24bd90cd821f96f31d594eeec
更改的原因是为了更好的扩展,直接指定就可以,参看代码:
https://github.com/fecshop/yii2_fecshop/blob/master/services/url/Rewrite.php
public function init()
{
parent::init();
$currentService = $this->getStorageService($this);
$this->_urlRewrite = new $currentService();
/*
if ($this->storage == 'mongodb') {
$this->_urlRewrite = new RewriteMongodb();
} elseif ($this->storage == 'mysqldb') {
$this->_urlRewrite = new RewriteMysqldb();
}
*/
}
注释的代码是原来的,添加新的url rewrite实现方式,需要更改代码,这样扩展不方便,用现在的方式就不需要了,加上文件后,配置文件直接指定就OK了。