user4951
user4951

Reputation: 33080

How to get the exact directory of a script

Say I run

http://mymaindomain.com/helloworld/somescript.php

I want http://mymaindomain.com/helloworld/

How do I do so?

Upvotes: 0

Views: 53

Answers (1)

Ali
Ali

Reputation: 1383

Would you please check my answer?

https://stackoverflow.com/a/41407858/3821823

You can also define const variable like this:

const BASE_URL = 'http://mymaindomain.com/helloworld/';
// or
define('BASE_URL', 'http://mymaindomain.com/helloworld/');

echo BASE_URL;

Upvotes: 1

Related Questions