Forum und email

classkit_import

(PECL classkit:0.3-0.4 runkit:0.7-0.9)

classkit_import — Import new class method definitions from a file

Popis

array classkit_import ( string $filename )

Note: Táto funkcia nemože byť použitá na manipuláciu s práve bežiacou (alebo zreťazenou) metódou.

Warning

Táto funkcia je EXPERIMENTÁLNA. Správanie tejto funkcie, názov tejto funkcie a hocičo iné zdokumentované o tejto funkcii sa môže zmeniť bez povšimnutia v budúcom vydaní PHP. Používajte túto funkcii na svoje vlastné riziko.

Parametre

filename

The filename of the class method definitions to import

Vrátené hodnoty

Associative array of imported methods

Príklady

Example#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();

?>

Výstup horeuvedeného príkladu bude:

foo!
bar!