当我使用php打印字符串时,它会打印出像�C�a�r� �B�u�y�i�n�g�
如何删除此�
?
当我在html中使用这样的脚本工作正常
{category: "Auto", measure: 6600},
{category: "Best Car", measure: 22200},
{category: "Car Auction", measure: 5400},
{category: "Car Audio", measure: 60500},
{category: "Car Battery", measure: 6600},
但是当我尝试使用像这样的PHP打印时
<?php foreach($rows as $row){ ?>
{category: "<?php echo $row['ad_group']; ?>", measure: <?php echo $row['volume']; ?>},
<?php } ?>
答案 0 :(得分:0)
<强> FILTER_SANITIZE_STRING
强>
<强> var_dump(filter_var($your_string_variable,FILTER_SANITIZE_STRING));
强>
{category: "<?php echo 'Category'; var_dump(filter_var($row['ad_group'],FILTER_SANITIZE_STRING));
?>", measure: <?php var_dump(filter_var($row['volume'],FILTER_SANITIZE_STRING)); ?>},