vendor/fancyecommerce/fecshop/services/category/Image.php:72
/** * 通过产品图片的相对路径得到产品图片的绝对路径. */ protected function actionGetDir() //缺少str { return Yii::$service->image->GetImgDir($this->imageFloder.$str, 'common'); }
这个参数有的,需要设置,你可以参看一下图片帮助文档:http://www.fecshop.com/doc/fecshop-guide/instructions/cn-1.0/guide-fecshop_product_image.html
Yii::$service->category->image->getDir($str)会报错,你可以试试
@chenchaojie [[[#2楼](#comment2)](#comment2)](#comment2)
https://github.com/fecshop/yii2_fecshop/blob/master/services/category/Image.php
protected function actionGetDir() { return Yii::$service->image->GetImgDir($this->imageFloder.$str, 'common'); }
需要改成
protected function actionGetDir() { return Yii::$service->image->GetImgDir($this->imageFloder, 'common'); }
这个不可以传递$str,如果想要更改,可以在配置中更改参数 imageFloder 的方式,来自定义分类图片路径。
imageFloder
类中的public 变量,都可以在配置中设置,设置后,在service初始化的时候会注入到service 对象中
稍等,我在细看一下代码
请给予一下,这个函数调用的上下文,在哪里调用?
/** * 通过分类图片的相对路径得到分类图片的绝对路径. */ protected function actionGetDir($str) { return Yii::$service->image->GetImgDir($this->imageFloder.$str, 'common'); }
这个分类service的图片方法,应该是写了,没有被调用过,因此功能也没有报错,问题没有显露出来,需要在函数中加入$str 参数