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

search for in the

com_isenum> <com_get
[edit] Last updated: Fri, 24 May 2013

view this page in

com_invoke

(PHP 4)

com_invokeBir COM bileşeninin yöntemini çalıştırır [terk edilmiştir]

Tanımı

mixed com_invoke ( resource $comNesnesi , string $yontemAdi [, mixed $yontemDegistirgeleri ] )

com_invoke() işlevi, comNesnesi ile gönderimi tanımlanan COM bileşeninin yontemAdi yöntemini çağırır. com_invoke() işlevi hata durumunda FALSE döner, başarı durumunda yontemAdi değerini döner. yontemDegistirgeleri ile verilenler yontemAdi ile adı verilen yönteme geçirilir.

Örnek 1 com_invoke() yerine nesneye yönelik sözdizimi kullanın

<?php
// bu şekilde çağırmak yerine
$val com_invoke($obj'method'$one$two);
// bu şekilde çağırın
$val $obj->method($one$two);
?>

Bilginize: Bu işlev PHP 5'te yoktur. Yöntemleri çağırmak ve özelliklere erişmek için bu işlevin yerine normal ve daha doğal olan nesne yönelimli söz dizimini kullanmalısınız.



add a note add a note User Contributed Notes com_invoke - [1 notes]
up
0
tomer at parity-bit dot com
8 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.

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

 
show source | credits | stats | sitemap | contact | advertising | mirror sites