Mark Luiken
Mark Luiken

Reputation: 19

Require once path doesn't set properly

When I echo my path:

echo __DIR__ . '\..\functions\sanitize.php';

I get this:

C:\xampp\htdocs\website\php\core\..\functions\sanitize.php

But it has to be like this:

C:\xampp\htdocs\website\php\functions\sanitize.php

Why doesn't my path go one step back? It doesn't let me get out of the core folder.

What went wrong?

Upvotes: 0

Views: 25

Answers (2)

patrick
patrick

Reputation: 11721

You can use realpath: see manual

Upvotes: 0

Pierre
Pierre

Reputation: 649

You have to call realpath function as explained here : http://php.net/manual/en/function.realpath.php

Upvotes: 1

Related Questions