library php-class-method-exists
php class-method-exists
zhusaidong/php-class-method-exists
php class-method-exists
- Monday, June 25, 2018
- by zhusaidong
- Repository
- 1 Watchers
- 0 Stars
- 3 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
php-class-method-exists
php class-method-exists, (*1)
Introduction
php 动态调用类和方法时,需要2步:先class_exists
,再method_exists
。, (*2)
该组件将这2步合二为一。, (*3)
Usage
composer require zhusaidong/php-class-method-exists:dev-master
require('../vendor/autoload.php');
//demo class
class foo
{
public function public_fun(){}
private function private_fun(){}
}
//test foo1::public_fun
if(!ClassMethodExists::class_method_exists('foo1','public_fun'))
{
var_dump("foo1::public_fun",ClassMethodExists::errmsg());
}
//test foo::private_fun
if(!ClassMethodExists::class_method_exists('foo','private_fun'))
{
var_dump("foo::private_fun",ClassMethodExists::errmsg());
}
//test foo::public_fun
if(!ClassMethodExists::class_method_exists('foo','public_fun'))
{
var_dump("foo::public_fun",ClassMethodExists::errmsg());
}
dev-master
9999999-dev
php class-method-exists
Sources
Download
BSD-2-Clause
by
zhusaidong