Home > Backend Development > PHP Problem > How to access a method in a php file

How to access a method in a php file

Guanhui
Release: 2023-02-28 21:46:02
Original
3988 people have browsed it

How to access a method in a php file

How to access a method in a php file

First, you can write the method name into the URL;

How to access a method in a php file

Then get the method name through "$_GET" in the php file;

$action = $_GET['action'];
Copy after login

Finally, call the method corresponding to the method name through the "call_user_func()" function, The return value is the value returned in the method.

$action = $_GET['action'];

function test()
{
    echo "测试";
}

call_user_func($action);
Copy after login

Output result: ce

The above is the detailed content of How to access a method in a php file. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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