1. There is no global static variable in PHP
Done before. NET development, you can use the following methods to cache some data:
View Plaincopy to Clipboardprint?
|
PGP is an interpreted language, although there are static modifiers, but the meaning is with. NET is completely different.
Even if a variable in the class is declared static, the variable is only valid in the application domain at the current page level.
2. Understanding Variable Scope
Variables declared outside the method body are not accessible within the method body.
Such as:
View Plaincopy to Clipboardprint?
|
The _displayurl method does not show any results because the variable, the _displayurl, is inaccessible in the method body, and global can be added to the prefix, such as the Displayurl method.
The global variables defined in the method body can be accessed outside the method body:
View Plaincopy to Clipboardprint?
?> |
You are reading about variable scopes in PHP Web development
- PHP Developer: Are you glammp?
- 10 section php common function code
- The idea and example of PHP implementing file Upload
http://www.bkjia.com/PHPjc/589158.html www.bkjia.com true http://www.bkjia.com/PHPjc/589158.html techarticle 1, there is no global static variable in PHP this is done before. NET development, you can use the following methods to cache some data: View Plaincopy to Clipboardprint? public class Test {private ...