如何对输入标签进行回显转义?

时间:2020-01-08 作者:esel

如何对此函数转义echo。。。

function pen_post_sidebar_twitter() {
    $twitter = esc_attr( get_option( \'twitter_handler\' ));
    echo ( \'<input type="text" name="twitter_handler" value="\'.$twitter.\'" placeholder="Twitter handler" /> <p class="description">Enter twitter handler without the @ sign.</p>\' );
}

1 个回复
SO网友:rajat.gite

试试这个

function pen_post_sidebar_twitter() {
    printf( \'<input type="text" name="twitter_handler" value="%s" placeholder="Twitter handler" /> <p class="description">Enter twitter handler without the @ sign.</p>\', esc_attr( get_option( \'twitter_handler\' ) ) );
}
谢谢