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::__constructКонструира ReflectionMethod

= NULL

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

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

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

Алтернативниот потпис е отфрлен од PHP 8.4.0, користете (PHP 8 >= 8.3.0) instead.

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

Параметри

objectOrMethod

Име на класа или објект (инстанца на класата) што ја содржи методата.

method

Име на методата.

classMethod

Име на класа и име на метода разделени со ::.

Errors/Exceptions

А ReflectionException се фрла ако дадената метода не постои.

Примери

Пример #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.