PHP global variables across files
问题 Ok, maybe my brain is just shut off, but I can't get this to work. Here's the complete code: Page1.php: <?php $something = "hello"; include "Page2.php"; ?> Page2.php: <?php echo $something; ?> Desired output (when navigating to Page1.php): hello The real output is blank. I have tried putting the global keyword everywhere, and nothing happens. Am I missing something? 回答1: I cannot replicate this error, just tried this on my localhost and copied and pasted your code from here. I suspect you