PHP5 the variable definition of classes in OOP follows an access control that is:Public represents the global, and the inner and outer subclasses of the class can be accessed;Private means that only this class can be used internally;Protected is
Several common php magic methods are introduced! (1) _ get and _ set methods. when the reference class does not contain members, you can call two methods. The _ set method must accept two parameters, used to store the name and attribute value of the
PHP to write a school website on the registration of new students to share the program, the example of PHP
We've got three pages:
(1), new Student Information Registration module (register.php):
Class Registration Form
PHP object-oriented programming-deep understanding of Method overloading and method coverage (polymorphism), and multi-state coverage. PHP object-oriented programming-in-depth understanding of Method overloading and method coverage (polymorphism),
Before PHP5, if you need to use a class, just use Include/require to include it directly
test.class.php
Copy CodeThe code is as follows:
Class abc{
function __construct ()
{
Echo ' www.hzhuti.com;
}
}
?>
load.php
The code is as follows
Copy
Php functions, classes and objects, encapsulation, inheritance of classes, static methods of classes, static properties 1. Functions & #160; & #160; & #160; php built-in functions can be used directly. If php extensions are not installed, you can & #
Copy CodeThe code is as follows:
Class Foo
{
Private $name = ' hdj ';
Public Function GetName () {
return $this->name;
}
}
Class Bar extends Foo
{
Public $name = ' Deeka ';
}
$bar = new Bar;
Var_dump ($bar->name);
Var_dump ($bar->getname
Fire Station College (bkjia.com) programming DocumentSelf generally points to static methods and constants of the current class, referenced by self:: Plus method name and constant name. $this is an instance object that points to the current class,
The Static keyword is used to describe the member attributes and member methods in the class. The final keyword can only be used to define the class and method. The final keyword cannot be used to define the member attributes, because final is a
Class a{
Public $name;
function Test1 ($a) {
echo "test1111";
}
function Test2 ($a) {
echo "test2222";
}
When an object calls a method and the method does not exist, the system automatically calls
Echo ' This is the first '. __line__. ' The line ';
?>
Copy CodeThe output is: This is the "2" lineThe full path and file name of the __file__ file. If used in the included file, returns the file name that is included. From PHP 4.0.
PHP before the Magic Function __autoload () method appears, if you want to instantiate 100 objects in a program file, then you have to include 100 class files with include or require, or you have to define the 100 classes in the same class file-- I
1. Abstract classes must be inherited to be used, not directly new
2. Abstract classes can have non-abstract methods
3. Subclasses must implement all abstract methods
4. Abstract class with Java
(Click to go) Abstract class for Java
read.php (used to display related topics)
Difficult issues
Topics: color= #993333 >
Include "connect.inc.php";$query = "SELECT * from Guestbook where id=". $theme _id;$res =
__set, __get,__isset, __unset is an object-oriented magic method used to manipulate friends. First look at how to use
echo $ class-a property; The following methods are called when a property or private protection property is not present
Public
A code syntax error occurs. please help me solve the problem. I learned programming in Eclipsephp, but the following error is always prompted when I downloaded a source program: & nbsp; & nbsp; & lt; dt & lt ;? Phpif ($ I % 2 = 0) echo $ class ;? &
PHP Magic Variables and Magic functions in a detailed
This article mainly introduces the PHP magic variables and Magic functions, as well as the use of examples, so that we learn to understand the PHP magic variables and Magic functions, the need
PHP Magic function __call () Usage Example analysis
This article mainly introduces the PHP magic function __call () usage, the example analyzes the function of the __call () function and the use of skills, with a certain reference value, the need
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.