跳到主要内容

此部分主要为不熟悉PHP的开发提供的,老手可以不用看。

定义命名空间

<?php 
namespace templates\index\defaults;

class Hook{
...
}
?>

即为:根目录/templates/index/defaults/目录下的Hook.class.php

使用定义的命名空间

<?php 
use templates\index\defaults\Hook;

class test{
public function testDemo(){
$hook=new Hook();
//若存在有静态变量或方法
$a=Hook::静态变量名称
$b=Hook::静态方法名称
}
}
?>