Home > Article > Backend Development > 【Thinkphp 5】 How to introduce extend extension file
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!