$this->dbAdapter
是Zend\Db\Adapter\Adapter
我试过了:
$this->dbAdapter::QUERY_MODE_EXECUTE // unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)
${this->dbAdapter}::QUERY_MODE_EXECUTE // unexpected '->' (T_OBJECT_OPERATOR)
${$this->dbAdapter}::QUERY_MODE_EXECUTE // Object of class Zend\Db\Adapter\Adapter could not be converted to string
$this->{dbAdapter::QUERY_MODE_EXECUTE} // Class "Local\Namespace\dbAdapter" not found
我能做的就是:
$dbAdapter = $this->dbAdapter;
...
$dbAdapter::QUERY_MODE_EXECUTE;
答案 0 :(得分:1)
我认为引用它的正确方法是:
img
或
use Zend\Db\Adapter\Adapter;
Adapter::QUERY_MODE_EXECUTE
它是一个常量,因此它不一定需要来自实例本身。您收到T_PAAMAYIM_NEKUDOTAYIM错误的原因是因为::是一个静态范围引用,您无法与$ this一起使用。