07c01-3.php
来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 24 行
PHP
24 行
<?php// Declare an autoload function and register it using SPLfunction __autoload($classname) { @require_once "class-{$classname}.php";}// Now create another one.function another_class_autoload($classname) { @require_once "obj-{$classname}.php";}// Check __autoload() has been declared before registering our functionif (function_exists('__autoload')) { spl_autoload_register('__autoload');}// Now register our own function.spl_autoload_register('another_class_autoload');// Instantiate an object of class 'cd'. // This will make it try to load the file: class-cd.php or obj-cd.php$mydisk = new cd();?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?