Why does my php support URL-based value transfer? Why does my php support URL-based value transfer? How to configure PHP to directly convert address bar parameters to global variables? The code is as follows: & lt ;? Php & nbsp; for ($ I = 1; $ I & lt; = $ a; $ I ++) & nbsp; & nbsp ;{& nbsp; & nbsp; & nbsp; for ($ j = 1; $ j & lt; = $ why does my php not support URL transfer?
Why does my php support URL-based value transfer? How to configure PHP to directly convert address bar parameters to global variables?
The code is as follows:
For ($ I = 1; $ I <= $ a; $ I ++)
{
For ($ j = 1; $ j <= $ a; $ j ++)
{
$ C = $ I * $ j;
Echo "$ I * $ j = $ c ";
}
Echo'
';
}
?>
In the example, enter http: // 127.0.0.1/practice/chengfabiao. php in the address bar? A = 9
We can display the multiplication table. Why does it still appear after I run it:
Notice: Undefined variable: B in d: \ APMXE5 \
Htdocs \ practice \ chengfabiao. php on line 2
It is certain that the value of a is not passed in. why is that? Is it necessary to modify the php configuration file?
Baidu gave an answer, "That's because the PHP configuration did not directly convert the address bar parameter to a global variable. you can modify the PHP configuration or the source program to solve the problem, for example, you can change $ a in the program to $ _ GET ["a"], and change B to be correct."
Now, I want to directly change the option in the configuration file, but I don't know which option to change?
Hope you can give me some advice!
--------------------------------
In the php. ini file, change register_globals = Off to register_globals = on
Remember: after modifying the php. ini file, restart the apache service. It is generally not recommended to modify php. ini to convert it directly to a global variable, which is not safe.