PHP类获取常量表达式包含无效操作

时间:2019-08-24 14:44:31

标签: php

我有以下PHP类代码:

class Docx
{
    private $namespaces = [
        'main' => 'http://schemas.openxmlformats.org/wordprocessingml/2006/main',
        'relationships' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
    ];

     private $document_references = [
        [
            'Id' => 'rId5',
            'Type' => $this->namespaces['relationships'].'/theme',
            'Target' => 'theme/theme1.xml',
        ],
    ];

    // ...
}

我收到Constant expression contains invalid operations错误消息,因为我使用了Constant expression contains invalid operations表达式。

如何引用$namespace['relationships']值?

0 个答案:

没有答案