Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:
非限定名称: 相当于“当前路径”
限定名称: 相当于“相对路径”
完全限定名称: 相当于“绝对路径” 修饰符“\”
使用别名的原因有二个: 简化, 重名
use app\admin\models\UserModel as UserModel;
$user = new UseModel;
use app\admin\models\UserModel;
$user = new UseModel;
class UserModel
{
private $age;
}
use app\admin\models\UserModel as User;
$user = new User;
spl_autoload_register(function ($class) {
$file = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
require $file;
});
全局成员:类,函数,常量
访问类:,只在当前空间中查找,找不到拉例,不会自动去全局找找
访问函数: 如果当前空间不存在,会自动到全局去查询
访问常量: 如果当前空间不存在,会自动到全局去查询
create test collate utf8mb4_unicode_ci;
use test;
show databases;
select database();
drop database test;
create table user(
id int unsigned auto_increment not null primary key,
name varchar(100) not null comment '姓名',
age date not null comment '年龄',
gender enum('male','female') not null comment '性别',
add_time timestamp not null comment '创建时间'
)engine = innodb auto_increment = 1 collate = utf8mb4_unicode_ci;
insert user (name,age,gender) values ('jack','1998-2-3','male');
use test;
update user set gender = 'female' where id = 1
select * from user