file_get_contents | escaping doesnt show the page

I have below code.echo $FileContents;shows the page which comes the php variable correctly, but the escape function whic

I have below code.echo $FileContents;shows the page which comes the php variable correctly, but the escape function which is <?php esc_html( $FileContents ); ?>didnt show anything.

How can I escape it correctly and show the page?

<?php global $redux_demo; ?>
<div class="row">
    <div class="col-md-12 ulockd-mrgn1210">
        <?php $FileContents = file_get_contents($redux_demo['text-location-service-details']); ?>
        <?php echo $FileContents; ?>
        <?php esc_html( $FileContents ); ?>
    </div></div>

I have below code.echo $FileContents;shows the page which comes the php variable correctly, but the escape function which is <?php esc_html( $FileContents ); ?>didnt show anything.

How can I escape it correctly and show the page?

<?php global $redux_demo; ?>
<div class="row">
    <div class="col-md-12 ulockd-mrgn1210">
        <?php $FileContents = file_get_contents($redux_demo['text-location-service-details']); ?>
        <?php echo $FileContents; ?>
        <?php esc_html( $FileContents ); ?>
    </div></div>
Share Improve this question asked Jun 16, 2020 at 2:50 Javascript Asking AccountJavascript Asking Account 51 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Well, esc_html() doesn't echo/display the return value (escaped string), so you need to call echo manually:

echo esc_html( $FileContents );

Update

If you actually want to filter the list of allowed HTML tags in the variable's value, then you can use the WordPress' KSES functions like wp_kses_post() and wp_kses_data():

echo wp_kses_post( $FileContents );
echo wp_kses_data( $FileContents ); // allows basic HTML by default

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742346284a4426608.html

相关推荐

  • file_get_contents | escaping doesnt show the page

    I have below code.echo $FileContents;shows the page which comes the php variable correctly, but the escape function whic

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信