REGISTER
|
Search Tycoon Talk
|
Freelancer.com
|
Members
Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.
Register Here
Forum Rules
PHP Forum
You are currently viewing our PHP Forum as a guest. Please
register
to participate.
Login
Remember Me?
Login via Freelancer.com
Tycoon Talk
>
Web Development and Programming Support
>
PHP Forum
>
Help with $_Server variables
Link Back
Thread Tools
Search this Thread
Help with $_Server variables
08-16-2007, 08:17 AM
#
1
(
permalink
)
Help with $_Server variables
colbyt
Defies a Status
Posts: 1,606
Trades:
0
Talkupation:
I am trying to extract a server path including directory from the $_Server Predefined Variables. I seem to be able to get everything except what I want.
$_SERVER['DOCUMENT_ROOT'] yields /home/username/public_html/domain-name
$_SERVER['PHP_SELF'] yields /directory/filename
$_SERVER['SCRIPT_FILENAME'] yields /home/username/public_html/domain-name/directory/filename
What I want returned is /home/username/public_html/domain-name/directory/ Did I miss something somewhere?
If using explode on the 'SCRIPT_FILENAME' is the only option, I sure would appreciate some help on that.
__________________
Colbyt
Please login or register to view this content.
Registration is FREE
Register
now for full access!
08-16-2007, 10:15 AM
#
2
(
permalink
)
Re: Help with $_Server variables
neorunner
Yak Yak Yak Yak Yak
Posts: 593
Location: Rochester, MN
Trades:
0
Talkupation:
Could you just use document root, and php self combined?
Something like this: (I don't have my parser, so I can't check this)
$path= $_SERVER['DOCUMENT_ROOT'] . $_SERVER['PHP_SELF'];
You may have to tinker with it, but this should provide what you need.
__________________
Please login or register to view this content.
Registration is FREE
08-16-2007, 11:06 AM
#
3
(
permalink
)
Re: Help with $_Server variables
tripy
Do not try this at home!
Latest Blog Post:
GooTrans, a cross-platform python frontend to Goog...
Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades:
0
Talkupation:
PHP Code:
echo
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
]);
http://www.php.net/manual/en/function.dirname.php
should output
/home/username/public_html/domain-name/directory/
for
/home/username/public_html/domain-name/directory/file.txt
__________________
Only a biker knows why a dog sticks his head out the window.
Last edited by tripy; 08-16-2007 at
11:08 AM
..
08-16-2007, 01:28 PM
#
4
(
permalink
)
Re: Help with $_Server variables
colbyt
Defies a Status
Posts: 1,606
Trades:
0
Talkupation:
I appreciate the time you guys took to reply. I don't want the file name.
Quote:
What I want returned is /home/username/public_html/domain-name/directory/
Actually I don't plan to echo the statement at all. I want to do something else with it after I secure it as a variable.
__________________
Colbyt
Please login or register to view this content.
Registration is FREE
08-16-2007, 02:20 PM
#
5
(
permalink
)
Re: Help with $_Server variables
tripy
Do not try this at home!
Latest Blog Post:
GooTrans, a cross-platform python frontend to Goog...
Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades:
0
Talkupation:
Well then, simply don't echo what's returned by dirname()...
PHP Code:
$stuff
=
dirname
(
$file
);
__________________
Only a biker knows why a dog sticks his head out the window.
08-16-2007, 03:30 PM
#
6
(
permalink
)
Re: Help with $_Server variables
colbyt
Defies a Status
Posts: 1,606
Trades:
0
Talkupation:
I must be denser than a rock today. I never managed to make that work. On that page you linked to, I did find something that works.
Thanks for your help.
__________________
Colbyt
Please login or register to view this content.
Registration is FREE
« Reply to
Help with $_Server variables
Previous Thread
|
Next Thread
Tycoon Talk
>
Web Development and Programming Support
>
PHP Forum
>
Help with $_Server variables
Thread Tools
Search this Thread
Show Printable Version
Email this Page
Search this Thread
:
Advanced Search
Posting Rules
You
may not
post new threads
You
may not
post replies
You
may not
post attachments
You
may not
edit your posts
BB code
is
On
Smilies
are
On
[IMG]
code is
On
HTML code is
Off
Trackbacks
are
Off
Pingbacks
are
Off
Refbacks
are
Off
Forum Rules
Feeds:
RSS
JS
XML
Feeds for this forum:
RSS
JS
XML
LinkBack
LinkBack URL
About LinkBacks
Bookmark & Share
Digg this Thread!
Add Thread to del.icio.us
Bookmark in Technorati
Tweet this thread
Page generated in
2.11218
seconds with
12
queries