Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从数据库中创建一个 javascript 数组,如下所示:
var m = [ [one] [two] [three] ]
重要的是 typeof m 是对象。
使用Json_encode
$phparray; // This is your php array $jsArray = <?php echo json_encode($phparray); ?>; //do stuff with $jsArray now