/    Sign up×
Community /Pin to ProfileBookmark

Is there a way that I can print the path to a page

say the page is 123.php

so it can display /home/myserver/public_html/123.php

Thanks

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYMar 18.2006 — [code=php]echo $_SERVER["SCRIPT_FILENAME"];[/code]
Copy linkTweet thisAlerts:
@MauMar 18.2006 — LiLcRaZyFuZzY's script will work if you are working with the same file. However, if you want to get the absolute path for another file, you need to use [url=http://www.php.net/manual/pl/function.realpath.php]realpath()[/url].
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYMar 18.2006 — Well, well..hehe..he asked for the same file ? :p
Copy linkTweet thisAlerts:
@NogDogMar 18.2006 — [code=php]
echo __FILE__; // those are double underscores on each side
[/code]
×

Success!

Help @comptech520 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...