当前位置: 首页>>代码示例>>PHP>>正文


PHP ReflectionClass::getmethod方法代码示例

本文整理汇总了PHP中ReflectionClass::getmethod方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionClass::getmethod方法的具体用法?PHP ReflectionClass::getmethod怎么用?PHP ReflectionClass::getmethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReflectionClass的用法示例。


在下文中一共展示了ReflectionClass::getmethod方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 function run($functionname, $par)
 {
     $dir = dirname(dirname(__FILE__)) . "/plugin/";
     $returnarr = array();
     $arr = $this->traverse($dir, $returnarr);
     $pluginsArray = array();
     for ($i = 0; $i < count($arr); $i++) {
         $classpat = $arr[$i]['classpath'];
         require_once $classpat;
         $classname = $arr[$i]['classname'];
         if ($classname == "pluginInterface") {
             continue;
         }
         $reflectionClass = new ReflectionClass($classname);
         if ($reflectionClass->implementsInterface('pluginInterface')) {
             try {
                 $cla = $reflectionClass->newInstance();
             } catch (Exception $e) {
                 continue;
             }
             if (method_exists($cla, $functionname)) {
                 $function = $reflectionClass->getmethod($functionname);
                 // 					$this->runfunction($classname,$classpat, "getName", $par);
                 $str = $function->invoke($cla, $par);
                 array_push($pluginsArray, $str);
             }
         }
     }
     return $pluginsArray;
 }
开发者ID:stdroom,项目名称:MKAnalytics,代码行数:30,代码来源:pluginm.php

示例2: run

 static function run()
 {
     App::init();
     App::route();
     try {
         $obj = new ReflectionClass(App::$_controller . 'Controller');
         $instance = $obj->newInstanceArgs();
         $obj->getmethod(App::$_action . 'Action')->invoke($instance);
     } catch (Exception $e) {
         APP_DEBUG ? exit($e->getMessage()) : APP::log($e->getMessage());
     }
 }
开发者ID:eyblog,项目名称:mvc,代码行数:12,代码来源:system.php

示例3: callByParams

 protected function callByParams($serviceClass, $method, $request)
 {
     $serviceClass .= 'Service';
     if (is_array($request)) {
         $class = new \ReflectionClass($serviceClass);
         if (!$class->getmethod($method)) {
             throw new \Exception('Service class:method definition is invalid. Detail: ' . $serviceClass . ' : ' . $method . '. Request: ' . json_encode($request));
         }
     } else {
         throw new \Exception('Request is not right format: ' . json_encode($request));
     }
     $serviceObj = $serviceClass::getInstance();
     if (is_callable(array($serviceObj, $method))) {
         $response = call_user_func_array(array($serviceObj, $method), $request);
         return $response;
     } else {
         throw new \Exception('Service:method not found. Detail: ' . $serviceClass . ' : ' . $method);
     }
 }
开发者ID:tianyunchong,项目名称:php,代码行数:19,代码来源:BackendServer.php

示例4: route_control

function route_control($path)
{
    $domain_route_file = PATH_APP . "/include/domain_route.php";
    if (is_file($domain_route_file)) {
        include_once $domain_route_file;
        domain_route($path);
    }
    include_once PATH_PTPHP . "/libs/ui.php";
    $info = pathinfo($path);
    $model_file = str_replace(PATH_WEBROOT, "", $info['dirname']);
    PtApp::$model = PtApp::get_model($model_file);
    $model_file_path = PtLib\get_model_file_path($model_file);
    PtApp::$model_path = $model_file_path;
    if (is_dir(PATH_MODEL) && is_file($model_file_path)) {
        $model_action_name = "view_" . strtolower($info['filename']);
        $model_class_name = PtLib\get_model_class_name(PtApp::$model);
        if (class_exists($model_class_name)) {
            PtApp::$model_class_name = $model_class_name;
            $_reflector = new ReflectionClass($model_class_name);
            PtApp::$model_view_name = $model_action_name;
            if ($_reflector->hasMethod($model_action_name)) {
                $_reflector_func = $_reflector->getmethod($model_action_name);
                $_r_params = array();
                $_r_params_keys = $_reflector_func->getParameters();
                foreach ($_r_params_keys as $_k) {
                    $_r_params[] = $_k->getName();
                }
                $_r_args = array();
                foreach ($_r_params as $_k) {
                    $val = isset($_REQUEST[$_k]) ? trim($_REQUEST[$_k]) : null;
                    $_r_args[$_k] = $val;
                }
                $model_return = $_reflector_func->invokeArgs(new $model_class_name(), $_r_args);
                if ($model_return && is_array($model_return)) {
                    extract($model_return);
                }
            }
        }
    }
    PtApp::$control_path = $path;
    include_once $path;
    exit;
}
开发者ID:houlonglong,项目名称:easytee-me,代码行数:43,代码来源:PtApp.php

示例5: ReflectionClass

<?php

$class = new ReflectionClass('mysqli');
foreach ($class->getMethods() as $m) {
    echo $m->name . '<br>';
    $param = $class->getmethod($m->name);
    foreach ($param->getParameters() as $i => $parametro) {
        echo '-->' . $parametro->getName();
    }
}
开发者ID:joguer18,项目名称:framePHP,代码行数:10,代码来源:reflection.php


注:本文中的ReflectionClass::getmethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。