Assume that the content in one file named test1.php is {code...} and the content in another file named test2.php is {code...}. Then, access the test2.php program and report that the variable is not found. Excuse me, what do you think we should do?
Test1.php
File Content
The content of another file named test2.php
Then access the test2.php program and report that the variable is not found.
What are the solutions to these problems?
Reply content:
Assume thatTest1.php
File Content
The content of another file named test2.php
Then access the test2.php program and report that the variable is not found.
What are the solutions to these problems?
In PHP, global variables cannot be directly called in functions. In this Code, if you want to call $ a in the test function, you should first declare it with global.
Function test () {global $ a; echo $ ;}
A local variable in a function and a global variable may be faulty! We recommend that you first learn the definitions of local variables and global variables.