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

巴扎黑
巴扎黑Original
2016-11-23 09:21:141023browse

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.

Php code

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

calls the function.

Php code

// 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 }  
?>


Statement:
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