PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

com_isenum> <com_get
Last updated: Fri, 22 Aug 2008

view this page in

com_invoke

(PHP 4)

com_invoke Llama el método de un componente COM [obsoleta]

Descripción

mixed com_invoke ( resource $objeto_com , string $nombre_funcion [, mixed $parametros_funcion ] )

com_invoke() invoca el método con el nombre nombre_funcion del componente COM referenciado por objeto_com . com_invoke() devuelve FALSE en caso de fallo, devuelve el valor de retorno de nombre_funcion en caso de éxito. Todos los parámetros extra parametros_funcion son pasados al método nombre_funcion .

Example #1 No use com_invoke(), use la sintaxis OO en su lugar

<?php
// haga esto
$val $obj->metodo($uno$dos);
// en lugar de esto:
$val com_invoke($obj'metodo'$uno$dos);
?>

Note: Esta función no existe en PHP 5. En su lugar, se debería emplear la forma más directa y natural de la sintaxis OO.



add a note add a note User Contributed Notes
com_invoke
tomer at parity-bit dot com
01-Feb-2005 09:21
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.

http://php.net/manual/en/function.call-user-func.php

com_isenum> <com_get
Last updated: Fri, 22 Aug 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites