爱程序网

PHP基础之Autoload

来源: 阅读:

PHP的自动加载autoload机制很重要,这里做2个小练习

原创文章,转载请注明:http://www.cnblogs.com/phpgcs

文件结构如下,2种方式实现自动加载

1,自定义函数

2,spl_autoload_register()

liuyuan@ebuinfo:/var/www/phpgcs/php_autoload$ ll ./*-rw-rw-r-- 1 liuyuan liuyuan  800 Feb 19 11:39 ./func_autoload.php-rw-rw-r-- 1 liuyuan liuyuan  906 Feb 19 11:28 ./spl_autoload.php./include:total 16drwxrwxr-x 2 liuyuan liuyuan 4096 Feb 19 11:42 ./drwxrwxr-x 3 liuyuan liuyuan 4096 Feb 19 11:43 ../-rw-rw-r-- 1 liuyuan liuyuan  142 Feb 19 11:42 aClass.php-rw-rw-r-- 1 liuyuan liuyuan  143 Feb 19 11:42 bClass.php

相关文章列表: