943,169 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 34
  • PHP RSS
Sep 3rd, 2010
0

Can includes have a variable?

Expand Post »
I tried to write include "http://".$_SERVER["SERVER_NAME"]."/lol.php" and it didn't include it?
Similar Threads
Reputation Points: 10
Solved Threads: 2
Light Poster
GigsD4X is offline Offline
31 posts
since May 2010
Sep 3rd, 2010
0
Re: Can includes have a variable?
If you are trying to include from the root directory of your site, use:
php Syntax (Toggle Plain Text)
  1. include $_SERVER['DOCUMENT_ROOT']."/lol.php";
Reputation Points: 210
Solved Threads: 228
Nearly a Posting Virtuoso
chrishea is offline Offline
1,389 posts
since Sep 2008
Sep 3rd, 2010
0
Re: Can includes have a variable?
Yes it can, just a guess here, but it might be a typo, the semicolons are missing at the end of the statement.

For further reference:
Include
Reputation Points: 10
Solved Threads: 4
Light Poster
Triztian is offline Offline
28 posts
since Sep 2009
Sep 3rd, 2010
0
Re: Can includes have a variable?
Click to Expand / Collapse  Quote originally posted by chrishea ...
If you are trying to include from the root directory of your site, use:
php Syntax (Toggle Plain Text)
  1. include $_SERVER['DOCUMENT_ROOT']."/lol.php";
Hmm.. That didn't seem the work, it's probably because I'm on a subdomain?
Reputation Points: 10
Solved Threads: 2
Light Poster
GigsD4X is offline Offline
31 posts
since May 2010
Sep 3rd, 2010
0
Re: Can includes have a variable?
Oh I see what's going on! It isn't grabbing the code because SERVER_NAME is using the full path! But I can't use DOCUMENT_ROOT =\
Reputation Points: 10
Solved Threads: 2
Light Poster
GigsD4X is offline Offline
31 posts
since May 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC