【原创】框架使用class_exists()检查类是否存在要注意
全文约 79 字预计阅读 1 分钟
今天使用class_exists检查是否安装yii2官方扩展yiisoft/yii2-imagine类的时候
if(class_exists('Image')){}
这样无论怎么检查都是flash
原来框架里需要使用完整命名空间路径
use yii\imagine\Image;
if(class_exists('yii\imagine\Image')){}
这样才能正确检查类是否有效。
【原创】框架使用class_exists()检查类是否存在要注意
评论 0 条
暂无评论,来说点什么吧。