我目前正在处理一个问题,写一个recrusive函数来订购一些json数据.我有几个嵌套的对象数组,我需要订购单个幻灯片.结构类似于以下内容:
[
{
    "title": "a",
    "children": [
        {
            "title": "a-a",
            "children": [
                {
                    "title": "a-a-a"
                },
                {
                    "title": "a-a-b"
                }
            ]
        },
        {
            "title": "a-b",
            "children": [
                {
                    "title": "a-b-a"
                },
                {
                    "title": "a-b-b"
                }
            ]
        }
    ]
},
{
    "title": "b",
    "children": [
        {
            "title": "b-a",
            "children": [
                {
                    "title": "b-a-a"
                },
                {
                    "title": "b-a-b"
                }
            ]
        },
        {
            "title": "b-b",
            "children": [
                {
                    "title": "b-b-a"
                },
                {
                    "title": "b-b-b"
                }
            ]
        }
    ]
}
]
我写了一个递归函数:
var catalog …我正在处理 Sylius 1.5 项目,在我的本地环境中一切正常,但是在部署到我的开发环境时,我在过滤图像上遇到错误(使用 liip 想象过滤器)。
该环境由一个运行 sylius 的 docker php-apache 容器组成。主机代理对 docker 容器的请求。
这是我尝试在浏览器中加载图像的 url 时遇到的错误:
Unable to create image for path "b4/11/650996cb08ee2b5fef5dfc75b8b4.jpeg" and filter "sylius_shop_product_thumbnail". Message was "Unable to open image /var/www/html/public/media/image/b4/11/650996cb08ee2b5fef5dfc75b8b4.jpeg"
错误发生在这里: in vendor/imagine/imagine/lib/Imagine/Gd/Imagine.php (line 96)
观察:
这是发生错误的代码:
    public function open($path)
    {
        $path = $this->checkPath($path);
        $data = @file_get_contents($path);
        if (false === $data) {
            throw new RuntimeException(sprintf('Failed to open file %s', $path));
        }
        $resource = @imagecreatefromstring($data);
        if (!is_resource($resource)) {
            throw …