Home  >  Article  >  Backend Development  >  php calls methods in other php

php calls methods in other php

Guanhui
GuanhuiOriginal
2020-05-01 17:08:369376browse

php calls methods in other php

php calls methods in other php

First pass the four "include", "include_once", "require", and "require_noce" For any one of these functions, introduce other PHP files, and finally write the method that needs to be called.

Code example

A.php

<?php
//定义方法
function func_a()
{
    echo "我是A.php中的方法!";
}

B.php

<?php
require &#39;./A.php&#39;;
//调用A.php中的方法
func_a();

Output result: I am a method in A.php!

The above is the detailed content of php calls methods in other php. For more information, please follow other related articles on the PHP Chinese website!

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