unemployment Posted April 15, 2011 Share Posted April 15, 2011 What does this mean? {$GLOBALS['path']} Quote 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"; } Quote 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 Quote 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. Quote 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']); Quote 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? Quote 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/233826-globals/#findComment-1202112 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.