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