我在服务器端使用 ordertable response.Html 标签双引号在 jsonencode 响应中不匹配

I am using ordertable for server side response.Html tag double quotes are mismatched in jsonencode response

我正在使用 json_encode() 从控制器发送数据:

$status =     "<td id=status_".$value['id'].">".
                  "<button class='btn btn-icon-toggle active'  href='javascript:;' onclick='changeStatus(".$value['id'].", '0', ".$field.", ".$url.",".$action.")><i class='fa fa-check'></i>
                   </button> </td>";

输出是:

<button class="btn btn-icon-toggle active" href="javascript:;" onclick="changeStatus(1510, " 0',="" status,="" stores="" ajaxaction,restaurantstatus)="">

我需要的输出是:

<button class="btn btn-icon-toggle active" href="javascript:;" onclick="changeStatus(1510,0,'status','stores/ajaxaction','restaurantstatus')">

我该怎么办???

只需学习 string escape characters 并使用它!

$status = "<td id=\"status_".$value['id']."\">" . "<button class=\"btn btn-icon-toggle active\"  href=\"javascript:;\" onclick=\"changeStatus(".$value['id'].", 0, '".$field."', '".$url."','".$action."')\"><i class=\"fa fa-check\"></i> </button> </td>";