我有一个来自数据库的返回字符串。
返回字符串必须采用 javascript 格式。
<?php
$db = "this is a line
this is a new line";
?>
我将如何将上述转换为:
<?php $db = "this is a line \n this is a new line"; ?>
Javascript:
<script>
var jdb = <?php echo $db; ?>
</script>