Wordpress设置API字段回调

I solved the problem but I do not understand it. I was trying to render the output of a field callback function.

function field_ticker_callback() {
    $ticker_value = get_option("ticker"); ?>

        <input type="text" name="ticker" value="<?php echo $ticker_value; ?>" />

    <?php
    //echo "<input type="text" name="ticker" value="$ticker_value" />";
}

When I'm using the commented line instead, I get a white screen while loading the template. In every Tutorial I have seen they do it with an "echo".

You are using double quotes around your HTML attributes:

echo "<input type="text" name="ticker" value="$ticker_value" />";

Which means ending and starting the string without concatenation. This is invalid syntax so PHP throws a fatal error. You don't see the error because Wordpress disables them (if WP_DEBUG is false, which it is by default) so instead you just see a blank screen.

Use single quotes (or escape your double quotes):

function field_ticker_callback() {
    $ticker_value = get_option("ticker");
    echo "<input type='text' name='ticker' value='$ticker_value' />";
}