在WordPress主题定制器中使用PHP回显字符串

The main code is at the bottom.

I'm trying to customize the WordPress Theme Customizer and running into an issue.

Basically, there are a number of background images that can be selected. In the code below, if the selection 'subtle' is made, then the background image url will be url.com/image.png.

However, if the case 'nothing' is selected, I want the background image to pull in a color that's chosen from another selector. For example, I want it to spit out:

'{background: <?php echo $color_scheme_2; ?>;}'

I understand you can't use an echo in an echo, but I'm not sure how to code this properly to get it to work.

Here is the full code:

$color_scheme_end2 = get_option( 'color_scheme_end2' );
$example_position = get_theme_mod( 'background_image' );
if( $example_position != '' ) {
    switch ( $example_position ) {
        case 'nothing':
            // ** This is where I want the color_scheme2 to be spit out as the background color ** 
            break;
        case 'subtle':
            echo '<style type="text/css">';
            echo '.site-header {background-image: url("http://www.url.com/image.png/")';
            echo '</style>';
            break;

Thank you so much for any guidance you can provide!

This is how you can update the code, you can use concatenation operator(.):

$color_scheme_end2 = get_option( 'color_scheme_end2' );
$example_position = get_theme_mod( 'background_image' );
if( $example_position != '' ) {
    switch ( $example_position ) {
        case 'nothing':
            // ** This is where I want the color_scheme2 to be spit out as the background color **
            echo '<style type="text/css">';
            echo '.site-header {background: '.$color_scheme_2.';}';
            echo '</style>'; 
        break;
        case 'subtle':
            echo '<style type="text/css">';
            echo '.site-header {background-image: url("http://www.url.com/image.png/")';
            echo '</style>';
        break;