Home > Backend Development > PHP Tutorial > The file name where the php detection function is located

The file name where the php detection function is located

巴扎黑
Release: 2016-11-22 16:07:06
Original
1302 people have browsed it

A very simple function, using the reflection mechanism in PHP, specifically using the ReflectionFunction class, to obtain the specific location in the PHP script where the specified function is located. Create a reference script.

// Filename: functions.php 
<?php
function now() {
    return time();
}
?>
Copy after login

Call the function.

// Filename: call_now.php
<?php
require &#39;functions.php&#39;;
 
Reflection::export(new ReflectionFunction(&#39;now&#39;));
// Function [ function now ] { @@ H:\www\functions.php 2 - 4 }
?>
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template