viewPath . '/components/common'; } $component_file = "{$componentPath}/{$component}.$suffix"; if (isset(self::$loadedComponents[$component_file]) && $onceLoad) { //此组件已经载入过了 return; } self::$loadedComponents[$component_file] = true; //输出页面 echo Yii::$app->getView()->renderFile($component_file, $params) . "\n"; } }