相关疑难解决方法(0)

array_map并将2个参数传递给映射函数 - array_map():参数#3应该是一个数组

我有一个看起来像这样的抽象类:

abstract class Transformer {

    /**
     * Transform a collection of items
     *
     * @param array $items
     * @param bool $format
     * @return array
     */
    public function transformCollection(array $items, $format)
    {
        return array_map([$this, 'transform'], $items, $format);
    }

    /**
     * Transform a item
     *
     * @param array $item
     * @param bool $format
     * @return mixed
     */
    public abstract function transform(array $item, $format);

}
Run Code Online (Sandbox Code Playgroud)

然后我有以下实现它的类:

class ServiceLogTransformer extends Transformer {

    public function transform(array $service_log, $format = false)
    {
        return [
            'id'    => …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-4

16
推荐指数
3
解决办法
2万
查看次数

标签 统计

laravel ×1

laravel-4 ×1

php ×1