classkit_import

(PECL)

classkit_import -- Import new class method definitions from a file

说明

array classkit_import ( string filename )

注: 本函数不能用于操作当前正在运行(或运行链上)的方法。

警告

本函数是实验性的。本函数的行为,包括函数名称以及其它任何关于本函数的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。使用本函数风险自担。

参数

filename

The filename of the class method definitions to import

返回值

Associative array of imported methods

范例

例子 1. classkit_import() example

<?php
// file: newclass.php
class Example {
    function
foo() {
        return
"bar!\n";
    }
}
?>
<?php
// requires newclass.php (see above)
class Example {
    function
foo() {
        return
"foo!\n";
    }
}

$e = new Example();

// output original
echo $e->foo();

// import replacement method
classkit_import('newclass.php');

// output imported
echo $e->foo();

?>

上例将输出:

foo!
bar!


add a note add a note User Contributed Notes
There are no user contributed notes for this page.