Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: com_invoke - Manual
[go: Go Back, main page]

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

search for in the

com_isenum" width="11" height="7"/> <com_get
Last updated: Mon, 05 Feb 2007

view this page in

com_invoke

(PHP 4 >= 4.0.1)

com_invoke — COM コンポーネントのメソッドをコールする [非推奨]

説明

mixed com_invoke ( resource com_object, string function_name [, mixed function_parameters] )

com_invoke() は、 com_object が指す COM コンポーネントの メソッド function_name をコールします。 com_invoke() はエラーの場合に FALSE を返し、 成功時に function_name の返り値を返します。 追加パラメータ function_parameters の値が メソッド function_name に渡されます。

例 386. com_invoke() を使用せず、かわりにオブジェクト指向の構文を使用する

<?php
// こちらを使用します
$val = $obj->method($one, $two);
// こちらは推奨しません
$val = com_invoke($obj, 'method', $one, $two);
?>

注意: この関数は PHP 5 には存在しません。そのかわりに、標準的でより自然な オブジェクト指向の構文を使用してプロパティへのアクセスやメソッドの コールを行うべきです。



add a note add a note User Contributed Notes
com_invoke
tomer at parity-bit dot com
02-Feb-2005 05: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" width="11" height="7"/> <com_get
Last updated: Mon, 05 Feb 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites