I develop a project with Yii.
I need to require a plain .php file (not component, not a class, just a regular sequence of PHP functions definitions). What is the correct way to do this under Yii framework? Should I use plain require_once()?
require_once(Yii::app()->basePath . '/extensions/my-php-file.php');
Right?
Yes, it is! Yii is a fast, secure, and efficient PHP framework.
Yii is a high-performance, component-based PHP framework for developing large-scale Web applications rapidly. It enables maximum reusability in Web programming and can significantly accelerate your Web application development process. The name Yii (pronounced Yee or [ji:] ) is an acroynym for "Yes It Is!".
This release makes Yii 2 compatible with PHP 8.1, fixes a number of bugs and adds some enhancements.
Yes, that's correct.
Example:
require_once Yii::app()->basePath . '/extensions/PearMail/Mail-1.2.0/Mail.php';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With