PHP 5.6.0beta1 released


(PHP 4)

com_invoke Chiama un metodo di un componente COM.


mixed com_invoke ( resource $oggetto_com , string $nome_funzione [, mixed $ parametri, ... ] )

com_invoke() chiama un metodo del componente COM referenziato da oggetto_com. Restituisce FALSE in caso di errore, altrimenti restituisce il valore di ritorno di nome_funzione.

add a note add a note

User Contributed Notes 1 note

tomer at parity-bit dot com
9 years ago
Note that if you want to use a string to specify the method to call (e.g. a drop-down list to decide what to do to a server process) you can do this in three ways.

The first is to use this function, as in <?php com_invoke($obj, $_GET['func']); ?>
That's bad.

The second is to use eval(), as in <?php eval("\$obj->{$_GET['func']}();"); ?>
That's very very very *very* bad.

The third is to use call_user_func(), as in <?php call_user_func(array($obj, $_GET['func'])); ?>
That's very good.

Remember to validate the user input against a list of allowed methods if a non-admin is at the console.
To Top