This time I will show you how to make a calling file class in PHP, and what are the precautions for making a calling file class in PHP. The following is a practical case, let's take a look.
Related recommendations: "PHP Tutorial"
First declare a class in a tool.php file:
<?php class tool { function say(){ $result="Hello,World"; return $result; } }
In another file main. PHP calls the method in the above class:
<?php require_once 'tool.php'; $tool=new tool(); $content=$tool->say(); echo $content; ?>
The above is the detailed content of What is the method of calling file class in php. For more information, please follow other related articles on the PHP Chinese website!