【Thinkphp 5】 How to introduce extend extension file

丿诺言丿
Release: 2023-03-19 16:26:01
Original
5885 people have browsed it

extend/maile/cc.php file directory

cc file must be added with a namespace, as follows

cc.php file content is as follows:

namespace maile; //The namespace maile is the folder name class Cc { //Class name
public function ac(){ echo "chengjing";
}
}

In the controller Try it out

use maile\cc; //Reference the cc.php file in the maile folder

public function index()
{
$b=new Cc(); echo $b->ac(); // Output chengjing

}


The above is the detailed content of 【Thinkphp 5】 How to introduce extend extension file. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!