I am setting up an application in PHP, trying to follow some of the conventions laid down in Laravel, I can see there are lots of references to $this->app["some_var"];
But in my app it throws an error saying "Cannot use object as an array".
I am aware that Laravel uses magic methods such as __get() and __set() which I have included, however I still get the same results.
The magic getter and setter code I have used in the parent class of my App object
/**
* Dynamically access container services.
*
* @param string $key
* @return mixed
*/
public function __get($key)
{
return $this[$key];
}
/**
* Dynamically set container services.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function __set($key, $value)
{
$this[$key] = $value;
}
Expected result is for it to access any property that is innaccessable on the object?
Currently throws a Fatal error: Uncaught Error: Cannot use object Application as type of array.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire