简体   繁体   English

console.log上显示什么类型的数据?

[英]What type of data is showing on console.log?

I'm wondering what type of data is the like of this: 我想知道什么样的数据是这样的:

在此处输入图片说明

I want to generate one properly in PHP, because that is the required type of a parameter in a certain JS function. 我想在PHP中正确生成一个,因为那是某个JS函数中参数的必需类型。

Is it a string, array, object? 它是字符串,数组,对象吗?

That's an array of strings. 那是一个字符串数组。 You can generate one in PHP using json_encode : 您可以使用json_encode在PHP中生成一个:

echo json_encode(array("36", "45"));
// => ["36", "45"]
<?php $phpArray = array(
          0 => "36", 
          1 => "45"
    )
?>
<script type="text/javascript">
    var jArray= <?php echo json_encode($phpArray ); ?>;
</script>

Refrences Refrences

json_encode json_encode

array in php PHP中的数组

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

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