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!