unemployment Posted April 15, 2011 Share Posted April 15, 2011 What does this mean? {$GLOBALS['path']} Link to comment https://forums.phpfreaks.com/topic/233826-globals/ Share on other sites More sharing options...
unemployment Posted April 15, 2011 Author Share Posted April 15, 2011 My problem is that I can't get these image paths to load the image. Any idea why? if (file_exists("../mysite.com/{$GLOBALS['path']}/img/avatars/users/${username}.png")) { return "../mysite.com/assets/img/avatars/users/${username}.png"; } Link to comment https://forums.phpfreaks.com/topic/233826-globals/#findComment-1202087 Share on other sites More sharing options...
mikosiko Posted April 15, 2011 Share Posted April 15, 2011 echo, var_dump or print_r $GLOBAL['path'] to see what is on it and check if the value make sense in that code Link to comment https://forums.phpfreaks.com/topic/233826-globals/#findComment-1202089 Share on other sites More sharing options...
KevinM1 Posted April 15, 2011 Share Posted April 15, 2011 $GLOBALS is a superglobal array (like $_GET and $_POST) of all variables currently in global scope. Chances are, your design has an issue if you're using it. Link to comment https://forums.phpfreaks.com/topic/233826-globals/#findComment-1202093 Share on other sites More sharing options...
unemployment Posted April 15, 2011 Author Share Posted April 15, 2011 echo, var_dump or print_r $GLOBAL['path'] to see what is on it and check if the value make sense in that code This doesn't return anything... echo var_dump($GLOBAL['path']); Link to comment https://forums.phpfreaks.com/topic/233826-globals/#findComment-1202104 Share on other sites More sharing options...
KevinM1 Posted April 15, 2011 Share Posted April 15, 2011 Do you have a variable named $path anywhere in your code? Link to comment https://forums.phpfreaks.com/topic/233826-globals/#findComment-1202105 Share on other sites More sharing options...
unemployment Posted April 15, 2011 Author Share Posted April 15, 2011 Ok so I slightly made a mistake. I didn't need the global path but why won't the path work on my subdomain? ../mysite.com/assets/img/avatars/users/${username}.png Do I need to have http://mysite.com/assets/img/avatars/users/${username}.png ? Link to comment https://forums.phpfreaks.com/topic/233826-globals/#findComment-1202112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.