I have a
public $errorCode;
public static $errorMsg = array(
100=>'Producto inexistente',
101=>'Máximo de sesiones simultáneas alcanzado',
102=>'No se pudo renovar la sesión',
103=>'Sesión inexistente',
104=>'No se pudo iniciar la sesión',
105=>'No se pudo finalizar la sesión',
);
in my Component.
I'm trying to access it this way:
var_dump( Yii::app()->productSession->errorMsg );
But will display Undefined property
.
When I try var_dump( Yii::app()->productSession::errorMsg );
I get unexpected ::
Is it possible to access this property? If I let this public
only it would work, I just don't want these strings populate memory in multiple instantiation. Thanks!
You forgot to specify the $ :
var_dump( ProductSession::$errorMsg );
EDIT
Yep, sorry, :: is the operator for static members, so it does'nt fit on an instance : use the class name
Also check the PHP site, the case is well documented : Static keyword
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.