Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

How to access object properties in Grav?

Started by Alexander Kim 8 years ago · 1 replies · 823 views
8 years ago

Here's the output of dump(Grav::instance()['uri']):

image|435x500

I've tried to get #paths[2] this way Grav::instance()['uri']->paths[2], but i'm getting this error: Cannot access protected property Grav\Common\Uri::$paths

8 years ago

It's protected by the class definition. You're not allowed to access it directly. What exactly are you trying to get out of the object? If you look at the URI API, you'll see there's a path() method that may get you what you're looking for.

Suggested topics

Topic Participants Replies Views Activity
General · by jean-louis67, 3 days ago
2 81 2 days ago
General · by Andy Miller, 7 days ago
0 146 7 days ago
General · by Veehem, 1 week ago
0 145 1 week ago
General · by milkboy, 1 week ago
0 138 1 week ago
General · by ian russell, 2 weeks ago
2 226 2 weeks ago