PHP.mk документација

ReflectionMethod::__construct

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

reflectionmethod.construct.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека reflectionmethod.construct.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
ReflectionMethod::__construct

Референца за `reflectionmethod.construct.php` со подобрена типографија и навигација.

reflectionmethod.construct.php

ReflectionMethod::__construct

класата mysqli_driver

ReflectionMethod::__constructConstructs a ReflectionMethod

= NULL

public ReflectionMethod::__construct(object|string $objectOrMethod, string $method)

Поставете информации за локалот

public ReflectionMethod::__construct(string $classMethod)
Ги ескејпува специјалните знаци во стринг за употреба во SQL изјава

The alternative signature is deprecated as of PHP 8.4.0, use ReflectionMethod::createFromMethodName() instead.

(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2) ReflectionMethod.

Параметри

objectOrMethod

Classname or object (instance of the class) that contains the method.

method

Name of the method.

classMethod

Class name and method name delimited by ::.

Errors/Exceptions

А ReflectionException is thrown if the given method does not exist.

Примери

Пример #1 , тогаш експортот се враќа како example

<?php
class Counter
{
private static
$c = 0;

/**
* Increment counter
*
* @final
* @static
* @access public
* @return int
*/
final public static function increment()
{
return ++
self::$c;
}
}

// Create an instance of the ReflectionMethod class
$method = new ReflectionMethod('Counter', 'increment');

// Print out basic information
printf(
"===> The %s%s%s%s%s%s%s method '%s' (which is %s)\n" .
" declared in %s\n" .
" lines %d to %d\n" .
" having the modifiers %d[%s]\n",
$method->isInternal() ? 'internal' : 'user-defined',
$method->isAbstract() ? ' abstract' : '',
$method->isFinal() ? ' final' : '',
$method->isPublic() ? ' public' : '',
$method->isPrivate() ? ' private' : '',
$method->isProtected() ? ' protected' : '',
$method->isStatic() ? ' static' : '',
$method->getName(),
$method->isConstructor() ? 'the constructor' : 'a regular method',
$method->getFileName(),
$method->getStartLine(),
$method->getEndline(),
$method->getModifiers(),
implode(' ', Reflection::getModifierNames($method->getModifiers()))
);

// Print documentation comment
printf("---> Documentation:\n %s\n", var_export($method->getDocComment(), true));

// Print static variables if existant
if ($statics= $method->getStaticVariables()) {
printf("---> Static variables: %s\n", var_export($statics, true));
}

// Invoke the method
printf("---> Invocation results in: ");
var_dump($method->invoke(NULL));
?>

Горниот пример ќе прикаже нешто слично на:

===> The user-defined final public static method 'increment' (which is a regular method)
     declared in /Users/philip/cvs/phpdoc/test.php
     lines 14 to 17
     having the modifiers 261[final public static]
---> Documentation:
 '/**
     * Increment counter
     *
     * @final
     * @static
     * @access  public
     * @return  int
     */'
---> Invocation results in: int(1)

Види Исто така

Белешки од корисници

Нема белешки од корисници за оваа страница.
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.