简体   繁体   English

当使用来自把手的数据时,php echo()不会以html格式显示输出

[英]php echo() does not show output in html format when using data from handlebars

when i pass an hardcoded html string to php echo() it gets parsed to html format, but when the data from handlebars is passed it doesn't work. 当我将硬编码的html字符串传递给php echo()时,它会被解析为html格式,但是当来自把手的数据被传递时它不起作用。


  <li style="width:33%;padding:15px">Info : <?php echo"{{{envinfo}}}"?></li>





<script type="text/javascript">
        $("#yehhua").click(function(){
          alert("The paragraph was clicked.");
        });
        $(function() {
            $('#users').DataTable({
                processing: true,
                serverSide: true,
                ajax: '{!! route('jobapps') !!}',
                buttons: [
                    'excel', 'pdf'
                ],
                columns: [
                    { data: 'name', name: 'name' },
                    {
                        "className":'details-control',
                        "orderable":false,
                        "ordeing":false,
                        "searchable":false,
                        "data":null,
                        "defaultContent":''
                    },

                    { data: 'email', name: 'email' },
                    { data: 'created_at', name: 'created_at' },
                    { data: 'updated_at', name: 'updated_at' },
                    { data: 'phone', name: 'phone' },
                    { data: 'location', name: 'location' },
                    { data: 'envinfo', name: 'envinfo' }
                ]
            });

        });


            $('#users').on('click','td.details-control' ,function () {
                var tr = $(this).closest('tr');
                var row = table.row(tr);
                if ( row.child.isShown() ) {
                    row.child.hide();
                    tr.removeClass('shown');
                 }
                else {
                        row.child( template(row.data()) ).show();
                    tr.addClass('shown');
                }
            });


      var template = Handlebars.compile($('#details-template').html());


    </script>

tried many ways to echo the string, even tried storing it in a variable first thn using that variable in echo() 尝试了很多方法来回显字符串,甚至尝试将它存储在变量中,然后在echo()中使用该变量

my output 我的输出

handlebar is a javascript framework, and it is clearly seen that that handlebar data is in json format. 车把是一个javascript框架,可以清楚地看到车把数据是json格式。 you need to parse it before using with php 在使用php之前你需要解析它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM