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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

How to access object properties in Grav?

Started by Alexander Kim 8 years ago · 1 replies · 738 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 Jerry Hunt, 4 days ago
2 82 12 hours ago
General · by pamtbaau, 17 hours ago
1 55 16 hours ago
General · by Andy Miller, 1 day ago
0 45 1 day ago
General · by Marcel, 12 months ago
6 348 5 days ago
General · by Duc , 5 days ago
3 43 5 days ago