protected static function show_with_layout($_layout_name) { if ($_layout_name === null) { $_controller = get_called_class(); if (property_exists($_controller, 'layout')) { if ($_controller::$layout === null) { throw new developer_error('default layout cannot be null (which itself means use default layout...)'); } $_layout_name = $_controller::$layout; } else { $_layout_name = false; } } ob_start(); if ($_layout_name === false) { self::content(); } else { parent::$layout_pss = parent::$layout_pjs = $_layout_name; // layout tpl 里会调 self::content() echo self::render_tpl('layout/' . $_layout_name . '.tpl', context::get_escaped(), false); } $_html = ob_get_clean(); if (parent::$skeleton !== false) { ob_start(); // skeleton 对应的 tpl 里会 echo $_html; require view_dir . '/skeleton/' . parent::$skeleton . '.tpl'; self::send(ob_get_clean()); } else { self::send($_html); } }